How to install your LAMP server on Ubuntu Dapper(Ubuntu 6.06) - mostly command line...eek!

You can reference https://help.ubuntu.com/community/ApacheMySQLPHP

 

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

 

Here goes

 

If you aren't logged in as root then at the prompt type

sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server

 

Type your root password at the password prompt

 

After it installs, it's recommeneded that you increase the memory limit that PHP imposes on a script. Edit the /etc/php5/apache2/php.ini file using your favorite editor(vi, nano, emacs, etc..) and increase the memory_limit value.

The default is 8M.  Increase this value to whatever value you feel comfortable with.  I chose 50M.  Whether or not this is recommended I dont know but I'll post an update once I find out.

 

 

If all your applications that need access to mysql run on the same machine then you dont need to change the bind address for myssql in the /etc/mysql/my.cnf file to the IP that the network outside your box can see otherwise you can leave it at localhost

 

Next set your mysql root password by typing "mysql -u root" (no double quotes) at the prompt and then "mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');" at the mysql prompt(no double quotes).  And yes you do need the single quotes around root, localhost and yourpassword.

 

Create your the database that wordpress will use for the blog

mysql> CREATE DATABASE database1;  (database1 is just an example but you can name it anything you want)

 

You need to also create a user that wordpress can use to access the DB.  For security reasons I only wanted this user to be able to access and modify my database for wordpress so I used the command below to create the user

mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON database1.* TO 'yourusername'@'localhost' IDENTIFIED BY 'yourpassword';

 

To administer MySQL phpadmin or mysql-admin are good choices.  Keep in mind that to apt-get these packages you'll have to enable the the universe repository in the /etc/apt/sources.list file.  So "sudo vi /etc/apt/sources.list"(again you can use any editor for this) and uncomment out the two lines below then do a "apt-get update" at the prompt to update the list of packages available in the universe repository and then do "apt-get install phpadmin" or "apt-get install mysql-admin" to install either package.  When you're done you can comment out the universe repo

 

#deb http://us.archive.ubuntu.com/ubuntu/ dapper universe

#deb-src http://us.archive.ubuntu.com/ubuntu/ dapper universe

 

 

Now last thing for the configuring your LAMP server is you need to let apache know where your mysql.so file is located.  My installation was done on Ubunbu Dapper aka Ubuntu 6.06 so this last step is for that version only.  You can check https://help.ubuntu.com/community/ApacheMySQLPHP to find out what you need to do for Ubuntu Breezy.

 

You'll need to run updatedb at the prompt to update the built in database that stores a list of every file on your system.  When that completes you can type locate mysql.so to find the path to that file.  Use your favorite editor(ex. vi, nano, gedit) to edit the php.ini file located here /etc/php5/apache2/php.ini and add the path of the mysql.so file to the extention_dir variable(ex. extension_dir= "/usr/lib/php5/20051025/")

 

Restart apache with this command "sudo apache2ctl restart"

 

That's it!

 

Next you need to install WordPress.  Which is so easy I'm just going to give you the link to the installation doc.  Hhttp://codex.wordpress.org/Installing_WordPress

 

 

The only other TIP I'll tell you is that once you have wordpress installed you need to make sure your blog address is set to the name the outside uses for your website.  For example, let's say you installed this on a linux server that has a NATed private IP(i.e 10.10.x.x, 192.168.x.x) on your LAN and you're forwarding port 80 or whatever port apache listens on from your router/firewall to this server.  The outside world knows this web server as www.mysite.com but inside your LAN the name of the server is "myserver".  By default wordpress will put http://myserver/myblogdir(myblogdir is the directory your wordpress files are in) as your blog address and when the outside world tries to access your blog it will try to redirect them to this url.  You need to go into the options within wordpress and change that blog address to "http://www.mysite.com/myblogdir" because the outside world doesn't even know that "myserver" exists.  Otherwise to people outside your lan the page will be distorted.  I hope that made sense.  Email me if it doesn't and I'll try to break it down for you.