Hemanth's Scribes

cli

Java CGI Tomcat Apache PHP MySQL on Ubuntu - Easy Steps

Author Photo

Hemanth HM

Thumbnail

Instead of giving introductions and speeches, I would love to tell you only the steps.

P.S: You have to be root while executing the commands mentioned below.

LAMP

apt-get update
sudo apt-get install apache2 php5 mysql-server-5.0 phpmyadmin
# Wait till its done

sudo gedit /etc/apache2/apache2.conf

Step 4 will open a text file for you. Paste the below to the end of the file, save and exit:

# Enable PHPMyAdmin
Include /etc/phpmyadmin/apache.conf

Restart Apache:

sudo /etc/init.d/apache2 restart

Check if you were right till now:

CGI

sudo aptitude install libapache2-mod-perl2
sudo rm -r /usr/lib/cgi-bin
sudo mkdir /var/www/cgi-bin  # if it fails use -p option
cd /usr/lib/
sudo ln -s /var/www/cgi-bin/ cgi-bin

Check if you were right till now:

cd /var/www/cgi-bin
sudo gedit test.pl  # a text file opens

Paste the below, save and exit:

#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
print "I love Linux\n";
sudo chmod a+x test.pl

Go to localhost/cgi-bin/test.pl in a browser.

It must say “I love Linux”

That’s it :) Enjoy Programming :)

#linux#java
Author Photo

About Hemanth HM

Hemanth HM is a Sr. Machine Learning Manager at PayPal, Google Developer Expert, TC39 delegate, FOSS advocate, and community leader with a passion for programming, AI, and open-source contributions.