Almost Automatic WebServer Installer

Write tutorials here
There are more tutorials here
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
Level 1
Level 1
Posts: 13
Joined: Sun May 27, 2012 3:43 pm
Location: The Netherlands

Almost Automatic WebServer Installer

Postby Yoshi2889 » Sun Jun 17, 2012 3:24 pm

I wanted to install a complete webserver on my laptop, but I'm too lazy to install the stuff myself. So I wrote this little script which installs Apache 2, PHP 5 and MySQL along with phpmyadmin and the links for you.

System Requirements
- A Linux operating system with APT-GET command (aka APT packager)
- Working internet connection
- A terminal

How to use
Place the file anywhere you like, mark it as executable (Right click > Properties > Rights > Allow execution) and run it from a terminal WITH SUDO (you can drag and drop the file in the terminal after you typed "sudo " (no the space is not a typo)). So if you have it in your Downloads folder:

Code: Select all

sudo ~/Downloads/

The installers for MySQL and phpMyAdmin will ask you a few things.

You can also run the installer to update the components installed.

Tested on
- Linux Mint 13 Cinnamon 64-bit as main OS
- Ubuntu 12.04 64-bit in VirtualBox

(842 Bytes) Downloaded 99 times

Try it out, and please report bugs to me :)

User avatar
Level 6
Level 6
Posts: 1042
Joined: Sun Sep 04, 2011 12:39 pm

Re: Almost Automatic WebServer Installer

Postby sagirfahmid3 » Sun Jun 17, 2012 7:20 pm

It is absolutely NOT necessary to download this script. I'm sorry, I'm not trying to be rude or anything, but a script to install only THREE things is a LOT of time wasted (especially with all those prompts).

Simple 3 liner code to paste in terminal to do whatever the script does (source: ):

Code: Select all

sudo apt-get install apache2 apache2-mpm-prefork apache2-utils apache2.2-common libapache2-mod-php5 libapr1 libaprutil1 libdbd-mysql-perl libdbi-perl libmysqlclient15off libnet-daemon-perl libplrpc-perl libpq5 mysql-client-5.0 mysql-common mysql-server mysql-server-5.0 php5-common php5-mysql

Contents of script below (it is ALWAYS a good idea to post the contents along so users may see what is within):

Code: Select all



# Prompt the user for confirmation, don't do anything when the user doesn't want to!
echo 'Welcome! This script will install Apache 2, PHP 5, MySQL and phpMyAdmin for you. Do you wish to continue?'
echo '[Y/n] '

read -n 1 yn

if [ $yn == 'n' ]
      echo ''
      echo 'Too bad. Lets hope you come back at another time.'

echo 'Okay, I will now go on with installing Apache. Please do not open localhost in the meantime. If this fails, please run this script with SUDO.'
# Unattended install of the apache2 package.
sudo apt-get -q -y install apache2

echo 'Done! Lets install PHP now.'

# Install PHP5
sudo apt-get -q -y install php5

echo 'Also done! Wonderful. Lets install MySQL now.'

# Install the MySQL server.
sudo apt-get -q -y install mysql-server

echo 'Awesome, just a few more things to install and we are done. Please be patient as things do not work when I am busy.'

# Install the link between Apache and PHP.
sudo apt-get -q -y install libapache2-mod-php5
# And between PHP and MySQL
sudo apt-get -q -y install php5-mysql
# Now install phpmyadmin
sudo apt-get -q -y install phpmyadmin

echo ''
echo 'CHMODding /var/www to 0755...'
sudo chmod -R 0755 /var/www

echo ''
echo 'Done! You can now access your webserver at http://localhost/. The files are stored in /var/www. Please run "sudo chown -R (your username) /var/www" to write files to the directory. Have fun with your webserver!'

Edit: PS, I also run a webserver. The command is "sudo apt-get install apache2 mysql-server phpmyadmin" and all the other packages are dependencies that are automatically pulled in and installed.

Level 1
Level 1
Posts: 13
Joined: Sun May 27, 2012 3:43 pm
Location: The Netherlands

Re: Almost Automatic WebServer Installer

Postby Yoshi2889 » Mon Jun 18, 2012 1:26 am

Heh, I know. I was just bored and wanted to learn a bit of bash.

User avatar
Level 24
Level 24
Posts: 21288
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Almost Automatic WebServer Installer

Postby xenopeek » Wed Jun 20, 2012 3:38 pm

Moved here by moderator

Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 5 guests