System Administration

Web Server Set Up in Linux and Windows

24 Jun , 2013  

This is an easy to follow guide on how to set up your computer system as a web server in both Linux and Windows OS. First, we need to setup your system with a web server, MySQL database server and PHP support. here is how to install it in your machine.

In Debian/Ubuntu based Linux:

For MySQL server execute these commands in your terminal:
sudo apt-get update
sudo apt-get install mysql-server
Please do keep in mind that sudo is a command to execute the next commant as root user, if you are already logged in as root then you won’t need to use sudo. In another Linux distribution other than Debian/Ubuntu derivatives, the installation steps is pretty much the same. But I guess you won’t need me to show you how after all I’m sure you know your distribution better than me. If you decided to install your MySQL server from source, I’m pretty much sure you do know how to do it if you decided to compile its source in the first place :).
Once the installation process started, just sit back, enjoy the show and have a cup of coffee. It won’t be too long after all, once it asks you your MySQL root user’s password just enter it and be done with it. Once the installation is finished you can test your MySQL server installation by logging in by entering mysql -u root -p at your terminal and enter your password when prompted.

For Web Server I’ll use Apache, but you can also use Nginx, and PHP installation, execute this command on your terminal:
sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
Then you can restart your Apache daemon using:
sudo /etc/init.d/apache2 restart or sudo service apache2 restart

Last but not least, I’ll add phpmyadmin which is a PHP-based web application for MySQL management which could make your life a lot easier. Keep in mind that by adding phpmyadmin you might make your server vulnerable for security attack. So please do some extra things to increase your security by using .htaccess, changing your phpmyadmin URL, etc. To install it enter this command:
sudo apt-get install phpmyadmin
During the installation process you will be asked whether you would use basic configuration or not. If you don’t know what your doing I suggest you choose yes, but fell free to explore and change your configuration. if you choose to use basic configuration, you just need to choose a few option. Select Apache as your web server if you do use Apache, enter your MySQL root user’s password and finally enter a password which you would use to log into phpmyadmin. Notice that these two log in would use root as their username but you could choose different password for each of them. For example to log into my MySQL i use username: root and password: mysqlpass, but in my phpmyadmin I use username: root and password: adminpass. So everytime i log into my MySQL server using mysql -u root -p I should enter mysqlpass as my password but when I open my phpmyadmin login page I enter root as username and adminpass as password. Once the installation is finished, you can open your phpmyadmin using URL http://localhost/phpmyadmin from a browser.

In Microsoft Windows:

You can always use XAMPP to make your life easier. It already included MySQL server, PHP support, and phpmyadmin. Just download it from here and follow the basic installation instruction like all Windows’ programs. If you are up to a more challenging experience though, you should try activating Windows’ web server program, the Internet Information Service (IIS) from Windows’ control panel and install MySQL server community edition, PHP, and phpmyadmin separately.

Latest posts by Satrio G. Nugraha (see all)

, , , ,


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.