Installing Apache, PHP, PostgreSQL, MySQL, JDK, NetBeans, VLC
Player in Ubuntu (Linux)
1. Please check that your internet first.
2. Open Terminal Window by clicking Applications Accessories Terminal
3. If you are installing first time, Please update your installer first using following
command:
$ sudo apt-get update
4. To install Apache use following command:
$ sudo apt-get install apache2
To set mod_rewrite of Apache to on use following command:
$ sudo a2enmod rewrite
5. To install PHP use following command:
$ sudo apt-get install php5
$ sudo apt-get install php5 libapache2-mod-php5
To install PHP-XSL (required for Propel) use following command:
$ sudo apt-get install php5-xsl
To install PHP-PEAR use following command:
$ sudo apt-get install php-pear
Please restart Apache to take effect of installation of PHP using following command:
$ sudo /etc/init.d/apache2 restart
6. To install PostgreSQL use following commands:
$ sudo apt-get install postgresql
$ sudo apt-get install postgresql-client
$ sudo apt-get install postgresql-contrib
$ sudo apt-get install pgadmin3
Above commands will install database client/server, some extra utility scripts and the
pgAdmin III GUI applications for working with the database.
Now we need to reset the password for the postgres admin account for the server, so we
can use this for all of the system administration tasks. Use following command:
$ sudo su postgres –c psql template1
# ALTER USER postgres WITH PASSWORD ‘postgres’;
# \q
Previous step alters the password for within the database, now we need to do the same for
the linux user postgres. Use following command to change:
$ sudo passwd –d postgres
$ sudo su postgres –c passwd
Now enter the same password that you used previously with ALTER USER command.
Then from here on in we can use both pgAdmin III and command-line access to run the
database server. But before you jump into pgAdmin we should setup the PostgreSQL
admin pack that enables better logging and monitoring within pgAdmin. Run following
command:
$ sudo su postgres –c psql < /usr/share/postgresql/8.4/contrib/adminpack.sql
Please take care of version of postgresql, if you are using Ubuntu 9.04 change your 8.4 to
8.3 in above command.
Finally, we need to open up the server so that we can access and use it remotely – unless
you only want to access the database on the local machine. To do this first, we need to
edit the postgresql.conf file. Open the file using following command:
$ sudo gedit /etc/postgresql/8.4/main/postgresql.conf
Now edit a couple of lines in the Connections and Authentication section:
Change #listen_addresses=’localhost’ to listen_addresses=’*’
Change #password_encryption=on to password_encryption=on
Save and Close the file. Now the final step, we must define who can access the server.
This can be done by editing pg_hba.conf. Open the file using following command:
$ sudo gedit /etc/postgresql/8.4/main/pg_hba.conf
Please edit following lines:
#local is for the Unix domain socket connections only
#TYPE DATABASE USER CIDR-ADDRESS METHOD
local all all md5
Please add following line at the end of the file:
#TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
Host all all [IP-ADDRESS] [SUBNET-MASK] md5
In last line, give IP-ADDRESS and SUBNET mask of the machine that you would like to
access your server. If you would like to enable access to range of IP addresses, just
substitute that last number to a zero and all machines within that range will allowed
access your system. My changes in pg_hba.conf file are shown below:
That’s it, now restart PostgreSQL to make the changes. Use following command:
$ sudo /etc/init.d/postgresql-8.4 restart
7. To connect PHP with PostgreSQL use following command:
$ sudo apt-get install php5-pgsql
8. To install MySQL, use following commands:
$ sudo apt-get install mysql-server
$ sudo apt-get install mysql-query-browser
$ sudo apt-get install phpmyadmin
Please open my.conf with following command:
$ sudo gedit /etc/mysql/my.cnf
Now make comment to one of its line by writing # in front of line as following:
#bind_address=127.0.0.1
One change in my.cnf is shown below:
Now restart Apache to make the changes permanent by using following command:
$ sudo /etc/init.d/apache2 restart
9. Now its time to create your own Document Root. The Document Root is the directory
where the Apache HTTP server takes files for displaying in the browser. The Document
Root is specified in the file that defines your virtual host. The default virtual host
configuration file is:
/etc/apache2/sites-available/default
with the Document Root
/var/www/
10. Please create Document Root Location, by clicking Places Home Folder. From
Context Menu, choose Create Folder and create a folder named public_html.
11. Now create new virtual host. Open Terminal window, by clicking Applications
Accessories Terminal. Make the copy of configuration file of default virtual host by
giving following command:
$ sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite
12. Open newly file i.e. mysite by using following command:
$ sudo gedit /etc/apache2/sites-available/mysite
13. Change the Document Root to point to new location:
/home/<username>/public_html
14. Change the Directory directive, replace <Directory /var/www/> with <Directory
/home/<user>/public_html/> . Make the changes as following. Change ubuntu with
your username. Save and Close the file. The file will look like as following:
15. To deactivate the default host and activate the new host give following command in
Terminal window:
$ sudo a2dissite default && sudo a2ensite mysite
Please restart Apache using following command:
$ sudo /etc/init.d/apache2 restart
16. Your new Document Root is ready now, Please create your php files and projects in
/home/<username>/public_html . In case of projects give its virtual host in
/etc/apache2/sites-available/mysite.
17. To install Java Development Kit Please go to System Administration Synaptic
Package Manager. Write sun-java in search box. Select sun-java6-jdk from below and
click Apply button in toolbox. Please follow the instructions; it will install JDK on your
machine. The Synaptic Package Manager is shown below:
18. To install NetBeans 6.8. First of all please download netbeans-6.8-ml-linux.sh from
http://netbeans.org/downloads/. Then go to folder where the downloaded file is change its
attributes using following command:
$ sudo chmod 755 netbeans-6.8-ml-linux.sh
When above command got executed, install NetBeans with following command:
$ sudo sh netbeans-6.8-ml-linux.sh
19. By default installer file to Ubuntu is .deb files. Download .deb file for Adobe Acrobat as
follows:
• Go to http://get.adobe.com/uk/reader/
• Click on Different language or operating system?
• From ‘Select an operating system’ Select Linux – x86 (.deb)
• Click on Continue
• On Next screen click on Download Now button. It will start downloading .deb
file.
• Now to install that file, just right click the file and select Open with GDebi
Package Installer. Click on Install Package button. This will install Adobe
Acrobat in your system.
• If you want to install through Terminal, you can use following command:
$ sudo dpkg –i AdbeRdr9.2-1_i386linux_enu.deb
20. To install VLC Player, use following command:
$ sudo apt-get install vlc vlc-plugin-* mozilla-plugin-vlc