If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
For this article, I’ll assume that you already have Ubuntu installed. It’s one of the easiest distro’s out there to install, ranking right up there with Fedora and Suse. After installation is complete, and you log in for the first time, you’ll most likely be prompted to install updates. Install these updates and reboot before continuing. Typically, you don’t need to reboot after an update, but just in case you updated your kernel, go ahead and do it.
Now, let’s get to it.
Open a terminal window and run the following commands:
sudo apt-get install apache2 mysql-server php5 libapache2-mod-php5 php5-xsl php5-gd php-pear libapache2-mod-auth-mysql php5-mysql
sudo sed -i ’s/; extension=mysql.so/extension=mysql\.so/g’ /etc/php5/apache2/php.ini
#That’s a series of 3 spaces after ’s/;
sudo /etc/init.d/apache2 restart
Reboot and you’re done!
What do those commands do? Well, the first one installs all of the packages needed. The second one uses sed to remove the semicolon (which denotes a comment) from the php config file, thus allowing php to work with mysql. The third one simply restarts apache.
In the above commands, there should only be 3 lines. Your display settings may cause the commands to span more than 3 lines. If so, just copy and paste line by line. Each command begins with sudo.
Related Articles
- Howto Setup a Remote Calendar using WebDAV with Mozilla Sunbird (6)
- Ubuntu Edgy Upgrade Common Problems With solutions (2)
- Disable and Enable Caps Lock in Ubuntu (12)
- Pytube – Best YouTube,Google manager, downloader and video converter for Ubuntu Linux (17)
- Build Low Cost LAMP Server using Ubuntu Edgy Eft in about 15min (10)
- Display Your system Information (Uptime,CPU,Memory,SCSI,IDE,PCI,Ethernet,Floppy,and Video) Using Phpsysinfo (4)
- Dual Booting Windows dan Ubuntu Fiesty (indonesian) (22)
- How To Import your mails from Evolution to Thunderbird (2)
- Install Mplayer in Ubuntu (3)
James:
Why don’t the three (3) spaces show in the line on this page?
sudo sed -i ’s/; extension=mysql.so/extension=mysql\.so/g’ /etc/php5/apache2/php.ini
using my cursor, I can move only ONE space between -i ’s/; extension . . .
Please clariy.
Non-breaking Space
The most common character entity in HTML is the non-breaking space.
Normally HTML will truncate spaces in your text. If you write 10 spaces in your text HTML will remove 9 of them. To add spaces to your text, use the character entity.
the text below will give you an example (paste it in a test.html file and try it out):
these are 4 spaces by using ‘ ’
@Mark,
Non-breaking Space
The most common character entity in HTML is the non-breaking space.
Normally HTML will truncate spaces in your text. If you write 10 spaces in your text HTML will remove 9 of them. To add spaces to your text, use the character entity.
the text below will give you an example (paste it in a test.html file and try it out):
these are 4 spaces by using ‘ ’
Z:-)
‘\.’ should be used into regular expresion on sed.
Better:
sudo sed -i ’s/; extension=mysql\.so/extension=mysql.so/g’ /etc/php5/apache2/php.ini
smoovb@s3rv3r:~$ sudo sed -i ’s/; extension=mysql\.so/extension=mysql.so/g’ /etc/php5/apache2/php.ini
sed: -e expression #1, char 1: unknown command: `
bash: /etc/php5/apache2/php.ini: Permission denied
I get this error when I try to use the second command. In addition, I tried the command with 3 spaces after “’s/;” and receive the same results.
Any suggestions?
I don’t know why the sed command isn’t working for you.
Try this instead… it’s just a few more steps.
sudo nano /etc/php5/apache2/php.ini
Type CTRL-W to search. Search for extension=mysql.so
Remove the leading semicolon.
CTRL-X to exit, save the changes.
Then, sudo /etc/init.d/apache2 restart
to restart Apache.
Why does the user have to reboot? If the services are up, there’s no point in doing this…you must be too used to Windows.
Yeah, you caught me. That must be it.
You can use tasksel for that. If you’ve ever done an installation from the server cd or dvd, then you’ll have noticed it. It’s the part that lets for choose LAMP, DNS, etc. Install and run it, and you’ll get some choices, like LAMP, DNS, Edubuntu server, etc.
I think in Apache 2 you don’t need the second command, it seems to work without that substitution.
Hey, nice easy work. Thanks heaps.
It might not have worked for @Smoovb if he did a copy/paste – ie if your browser converted the regular single quote (’) to an angled one, then the shell won’t like it.
Got this error for some reason:
sudo /etc/init.d/apache2 restart
* Restarting web server apache2 apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
Can someone explain what went wrong?
* Restarting web server apache2 apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
@Hemanth
open /etc/apache2/apache2.conf
sudo gedit /etc/apache2/apache2.conf
find the following line
ServerName
change
ServerName
save and exit the file
restart apache webserver
sudo /etc/init.d/apache2 restart
I did that but if i try to login to mysql , i am getting this
#2002 – The server is not responding (or the local MySQL server’s socket is not correctly configured)
@Hemanth
This is mysql server error
First you need to check mysql server is running or not
try to start using the following command
sudo /etc/init.d/mysql start
Check the log messages
cat /var/log/messages | grep mysql
guys, i am super nobie in ubuntu. i have no idea why it comes:
root@aminul-laptop:/home/aminul# sudo apt-get install apache2 mysql-server php5 libapache2-mod-php5 php5-xsl php5-gd php-pear libapache2-mod-auth-mysql php5-mysql
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Couldn’t find package apache2
root@aminul-laptop:/home/aminul#
please note that, i am not confident my ubuntu is installed properly. i don’t have much knowledge of ubuntu.
how to resolve the issue and enjoy lamp ?