I’ve developed in the Windows environment for most of my career. About 4-5 years ago I began to migrate to the Mac. Now my Mac is my primary computer.
I recently worked on a project where the target OS is linux, so I installed Ubuntu 9.04 desktop on an old PC. The following are the steps I took to create a web development box. This post assumes that you have already installed Ubuntu. Click here or here for installation instructions.
Next, I will install Python, Django, PostgreSQL, phppgadmin, and pgAdmin (needed for my new project). I will also install Aptana Studio and Java (need JRE to run Aptana). I have been using Aptana Studio on my Mac for over a year, and it has become my default development IDE.
Before installing the necessary files, run the Update Manager to ensure that Ubuntu is up to date (System->Administration->Update Manager).
First you need to verify whether the Apache webserver is already installed. The easiest way is to open your browser and enter http:/localhost/ or http://127.0.0.1. If Apache is installed, an html page will display:
If it does not display, open Terminal (Applications->Accessories->Terminal).
You could install Apache separately by entering:
sudo apt-get install apache2
sudo apt-get install lamp-server^
- When prompted, confirm that you want to install the package.
- At the next prompt, change the password for the root user on your MySQL database.
After the installation is complete, test the web sever again.
Open your browser and enter http:/localhost/ or http://127.0.0.1. If Apache is installed, an html page will display:
Restart apache, open terminal and enter:
Sudo /etc/init.d/apache2 start
Your web files are served from /var/www/.
So let’s create a file there. Open terminal and type:
gksudo gedit /var/www/pInfo.php
This will open an empty file named pInfo.php in the text editor.
<?php phpinfo(); ?>
Save the file and exit the text editor.
Now open your browser and navigate to http://locahost/pInfo.php/
You should see
Now, install phpMyAdmin. Open terminal and enter:
sudo apt-get install libapache2-mod-auth-mysql phpmyadmin
During the installation, you will be asked create a password so that phpMyAdmin can talk to MySQL. If you leave it blank, a random password will be generated for you.
Check to see whether /etc/apache2/conf.d/phpmyadmin.conf exists? You can do this in the terminal or check via the file browser (Places->File System).
If the configuration file does not exits, check whether /etc/phpmyadmin/apache.conf exists?
If it does, create a symbolic link:
sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
Now restart Apache:
sudo /etc/init.d/apache2 restart
To test your installation, open your browser and go to: http://127.0.0.1/phpmyadmin
You should see a login screen
You should now be ready to create your php applications, but let’s do one more thing. As I stated earlier, you web server files are located at /var/www/, but this directory requires admin rights in order to create files. So we will create a symbolic link.
First, open file browser (Places->Home).
Create a folder named public_html.
Now open terminal and enter:
ln -s /var/www/ /home/les/public_html/
Replace ‘les’ with your username. Now you can create all of your web files in your public_html folder.
First let’s install the Postgresql database. Open terminal and enter:
sudo apt-get install postgresql postgresql-client postgresql-contrib
Now type: psql
This command is used to enter interactive mode. You will receive an error:
psql: FATAL: Ident authentication failed for user "les"
Obviously, the user will be your username. Enter:
su - postgres createuser -P root
You will be prompted to enter your password and verify your password.
The new role will be superuser:
Shall the new role be a superuser? (y/n) y
You also may receive an error after typing: ‘psql’:
FATAL: Ident authentication failed for user "postgres"
To fix this, open your file browser and open:
localhost all all ident sameuser
localhost all all md5
Save the file and restart postgresql:
sudo /etc/init.d/postgresql-8.3 restart
sudo apt-get install phppgadmin
After installation, enter:
sudo ln -s /etc/phppgadmin/apache.conf /etc/apache2/sites-enabled/phppgadmin sudo /etc/init.d/apache2 restart
To test your installation, open your browser and go to:
If you receive an error:
Error: Login disallowed for security reasons.
We need to edit the phppgadmin config file. Open terminal:
sudo gedit /usr/share/phppgadmin/conf/config.inc.php
$conf['extra_login_security'] = true;
$conf['extra_login_security'] = false;
Save/close the file and then reload apache:
sudo /etc/init.d/apache2 reload
sudo apt-get install pgadmin3
After installation is complete, you can access it by going to Applications->Programming->pgAdmin III.
Installing Python and DJango
I could install Python and Django separately, but it is quicker to install them together:
sudo apt-get install python-django
To test your python installation, enter:
Your prompt should change to: ‘>>>’.
import django print django.VERSION
If you do not receive an error and a version appears, your installation was successful. I’ll talk more about Django in later posts.
To exit python command line, type:
One more thing. While setting up a Django project, I was trying to connect to the database when I received the error:
Error: No module named psycopg
Open terminal (if it is not already open) and enter:
sudo apt-get install python-psycopg2
Now I am going to install Aptana Studio. Before we do, we need to install Java:
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
To install Aptana, you need to go to the download page. Follow the instructions.
That’s it. Now start coding.Tags: Apache, Aptana Studio, django, install, Java, LAMP, Linux, MySQL, pgadmin, PHP, phpmyadmin, phppgadmin, Postgresql, Python, Ubuntu, web development