I decided to start my LINUX series finally. Something that I try to do for a long period of time but I don’t have enough time recently for building LINUX lab and testing it.
This topic is extremely useful for linux beginner, in my opinion. For those who want to raise web server and probably building web applications.
Before we start, we need LINUX distribution installed. I chose UBUNTU 14.04.3 ( DOWNLOAD ME ). I don’t have additional machine for Linux, so I am using VirtualBox ( How to install Ubuntu using VirtualBox ).
After you finish with the installation, start the new Linux machine. Open the Terminal and type:
sudo apt-get update
We are doing this step because we need to sure that everything inside the OS is up to date!
When the update is completed, again in Terminal, type:
sudo apt-get upgrade
The first command is going to update the list of packages and their versions on your machine without going through the process of actually installing them. The second command installs the packages. For this reason, you should always run the update command first and then upgrade.
First, let’s say stuff about Apache. What is Apache?
Apache is a freely available Web server that is distributed under an “open source” license. Version 2.0 runs on most UNIX-based operating systems (such as Linux, Solaris, Digital UNIX, and AIX), on other UNIX/POSIX-derived systems (such as Rhapsody, BeOS, and BS2000/OSD), on AmigaOS, and on Windows 2000. According to a Netcraft (www.netcraft.com) Web server survey 60% of all Web sites on the Internet are using Apache (62% including Apache derivatives), making Apache more widely used than all other Web servers combined.
Why I am choosing Apache?
Simply because it’s the world’s most popular web server software, it’s extremely stable, it’s well-supported, and it’s completely open source, which means you don’t have to pay anything for it. Pretty good reasons 🙂
So .. Again in your Terminal, type:
sudo apt-get install apache2
In order to verify that the installation completed successfully, open your web browser and type http://localhost.
You should be able to see “It works!”
To be sure that Apache and Python will work together we need some additional tools to make this happen. This special tools are called mod_wsgi and python-setuptools. In your Terminal type:
sudo apt-get install python-setuptools libapache2-mod-wsgi
After the installation is completed we need to restart the apache service:
sudo service apache2 restart
Basically, all you need to know for now is that you need database system. You have two choices here – MySQL / PostgreSQL. In this guide we will review MySQL but I will let you know about both.
MySQL is the more common of the two. It’s relatively easy to install and get working. It’s also very well-supported by third-party tools, as well as by most web hosts. And it’s an extremely fast tool due to the fact that it doesn’t implement the full SQL standard, or as many data types as other solutions (in particular: PostgreSQL). This makes MySQL a great tool to use when writing simple applications that run fast and are easy to set up, but that don’t need to do anything too complex.
PostgreSQL, on the other hand, is a SQL-standards-compliant tool that supports many more data types than MySQL. It’s extremely powerful, and it’s designed to power complex applications. You can achieve much more in PostgreSQL than you can using MySQL. However, PostgreSQL is a bit more complicated to set up, and it’s comparatively less performant for simple operations due to its large feature set.
To install MySQL use the following command:
sudo apt-get install mysql-server
During the installation a pink windows will pop-up asking for your password. Enter it, then verify it. Otherwise the installation won’t continue. When the installation is done, that’s how you log in:
mysql -u root -p
You can see that I am logged in the SQL server after entering my password the prompt changed to “mysql>”. This means that we are entering commands to the SQL server not the Linux. In order to leave the SQL server, type “exit”:
The last step is installing Python. Since Ubuntu is our Linux distribution of choice, we have the luxury of having Python automatically installed for us. If you are curious about what version is currently installed, simply type this command into the Terminal:
Similar to the SQL server we are in Python “mode”.
I wrote the simpliest program just to show you 🙂 You can see that there is also a compiler in the packet. It’s pretty good, indeed!
That’s was all required for having a LAMP server. I will continue with my Linux articles soon!