Almost Automatic WebServer Installer

Write tutorials and howtos in here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Do not start a support topic here please. Before you post please read this

Almost Automatic WebServer Installer

Postby Yoshi2889 on 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/installWebServer.sh


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

Download
installWebServer.sh.tar.gz
(842 Bytes) Downloaded 89 times


Try it out, and please report bugs to me :)
Yoshi2889
Level 1
Level 1
 
Posts: 13
Joined: Sun May 27, 2012 3:43 pm
Location: The Netherlands

Linux Mint is funded by ads and donations.
 

Re: Almost Automatic WebServer Installer

Postby sagirfahmid3 on 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: https://help.ubuntu.com/community/ApacheMySQLPHP ):
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
#!/bin/bash

clear

# 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' ]
   then
      echo ''
      echo 'Too bad. Lets hope you come back at another time.'
      exit;
fi

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.
User avatar
sagirfahmid3
Level 6
Level 6
 
Posts: 1054
Joined: Sun Sep 04, 2011 12:39 pm

Re: Almost Automatic WebServer Installer

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

Heh, I know. I was just bored and wanted to learn a bit of bash.
Yoshi2889
Level 1
Level 1
 
Posts: 13
Joined: Sun May 27, 2012 3:43 pm
Location: The Netherlands

Re: Almost Automatic WebServer Installer

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

Moved here by moderator
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14862
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands


Return to Tutorials / Howtos

Who is online

Users browsing this forum: bobww99 and 17 guests