I found this article on the internet and found it so interesting that I copied it to this blog.
Thanks for the person who wrote it : Mr Percival on the following link: http://www.parcival.org/2006/07/14/howto-install-joomla-on-your-very-own-ubuntu-server/
July 14, 2006 on 12:58 pm | In Computing |
You have a spare computer, you know that Joomla is a fairly powerful CMS, that Ubuntu is a really nice Linux distribution, and you’d like to combine all these things. So here is how it’s being done:
Make sure you are firewalled
We are going to install various services that can be accessed from users all over your network. However, I assume you want to keep out unwanted guests from the internet. Before you proceed, make sure that all ports are firewalled that connect you with the internet and no critical forwarding is active.
Download the necessary software
Download the Ubuntu server edition and the latest stable Joomla CMS.
Install Ubuntu
Burn the downloaded Ubuntu image onto a CD-R with your favorite CD writing program. (in most cases, burning an image to a CD is somewhere in the advanced section) On your spare computer boot from the newly created CD and pick the ‘Install LAMP’ option. This will install the Linux Apache Mysql PHP environment we are going to need to host our Joomla testsite.
Disclaimer: In the following sections, you are going to see the sudo
command a couple times. sudo
is used in Linux (and in Ubuntu particularly) so that an ordinary user can get admin/root privileges to maintain the system. I created a true root account (sudo passwd
) in my Ubuntu so I don’t have to mess with sudo
all the time. I tried to put the sudo
into the following code wherever necessary, but I probably forgot it a couple times. If you want to execute a command and your Ubuntu refuses to do it, you probably need to add a sudo
in front of it.
Upgrade Ubuntu
Free software is good, but it also has security problems just like any software that is being written. However, the good thing about free software is that those problems are minimal if you regularly update it. Luckily, this is fairly easy with Ubuntu, all you need is two commands:
#This will check online for the latest
#software packages and security fixes
sudo aptitude update
#This will download the latest packages of
#the software you already have installed
sudo aptitude upgrade
Repeat this regularly to ensure you have always the latest software and are protected from known exploits.
Optional: Add software that makes life easier
Sitting in front of that bare Linux screen may not exactly be what you consider to be fun and you probably want to manage and edit things from your own main desktop computer. To do so we need to install two more things and you can manage everything from your Mac/Windows/Linux computer. OpenSSH allows an encrypted = secure remote connection to your Ubuntu server. Samba allows you to access shares on your Ubuntu server similarly to remote Windows shares. We proceed to install:
sudo aptitude install ssh samba
You can also solely type sudo aptitude
and browse a GUI to add/remove software if you prefer that.
Now you can remotely access your Ubuntu server with your Ubuntu username and password.
On a Mac, open the Terminal application (it’s in Utilities) and enter
ssh your_username@ubuntus_IP_address
On a Linux computer, proceed the same as on the Mac - I believe you already know where your terminal is.
On a Windows computer, install putty and use this tool to connect to your Ubuntu server.
Now we still need to configure Samba so we are able to easily upload files onto our Ubuntu server. For this purpose we are going to edit /etc/samba/smb.conf with the nano editor (if it hasn’t been installed yet, do it with aptitude as explained above):
sudo nano -w /etc/samba/smb.conf
Now in this file you specifically want to pay attention to the to the homes share:
[homes]
comment = Home Directories
browseable = yes
writable = yes
Before anyone can do anything with Samba, we also have to create the necessary Samba account first:
smbpasswd -a your_username
This will enable access for remote users to their home directories. Let’s assume Slartibartfast has a Windows computer where he logs in with his name and password. He also has an account on your Ubuntu server with the same username and password and obviously also a matching Samba account. If that’s the case, Slartibartfast will be able to find in his Ubuntu home directory in his Explorer’s network neighborhood. (Mac Users: just hit Apple-K to mount the Samba share)
Setting up a place for your files to reside
Okay, now we have the Apache webserver installed. You can verify if it’s up and running by pointing your webbrowser to the IP address of your Ubuntu machine, e.g. http://192.168.0.1 This should load the generic Apache welcome site in your browser.
Next we need a place where you can store your (Joomla) files so they are being displayed when you attempt to open your site with your browser. In Ubuntu this is being done by creating a public_html directory in your /home directory. So do
mkdir public_html
in a terminal in your home directory or mount the samba share and create the directory in the file browser of your prference. When you have it, extract your Joomla files into it so that the index.php file and its fellows come to reside in your shiny new public_html.
In your home directory, also recursively set the proper read/write permissions (this is to ensure that Joomla can write the settings to disk):
chmod -R ugo+rwx public_html/
If it worked, the command ls -l
will display read/write/execute permissions for all users on your public_html folder.
Next we are going to check if we can access the site in our web browser by adressing it with the proper username in the URL.
#generic
http://your_ubuntu_IP/~username
#example for user Slartibartfast
http://192.168.0.1/~Slartibartfast
Now you should be greeted with the screen that lets you start with the Joomla configuration. Before we can start the Joomla configuration, there is one important step left.
Create the necessary database
Joomla stores its content in a database, so we still need to setup the MySQL database in Ubuntu. First we need to create a valid MySQL user: (see also this and this chapter of the MySQL documentation)
#first we log into the MySQL shell
mysql --user=root mysql
#now we create same user TWICE
GRANT ALL PRIVILEGES ON *.* TO 'your_username'@'localhost' IDENTIFIED BY 'your_password' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'your_username'@'%' IDENTIFIED BY 'your_password' WITH GRANT OPTION;
#we exit the MySQL shell again
exit
According to mkr it’s also okay to add only the localhost user as long as the Apache, PHP and MySQL are hosted on the same machine. I haven’t tested that, but it does make sense.
Furthermore, it’s also wise to set a password for the root user in MySQL:
mysql -u root
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyPW');
exit
Once we have the user we need to create the tables that belong to him/her: (see also the Ubuntu server guide on Joomla)
#we create the database for your user
mysqladmin -u your_username -p create your_database_name
#we log into our database
mysql -u db_user -p
#we set the priviledges
GRANT ALL PRIVILEGES ON your_database_name.* TO 'your_username' IDENTIFIED BY 'your_password';
#we activate the new permissions
flush privileges;
#we leave the MySQL shell again
exit
Optional: phpmyadmin
You may be one of those users who doesn’t like managing MySQL databases in a terminal very much. Well, you are in good company. If you prefer to manage your MySQL from now on by means of your webbrowser, those additional steps will take you there:
nano -w /etc/apt/sources.list
remove the comment marks for the universe repository. This will allow you to install phpmyadmin:
aptitude update
aptitude search phpmyadmin
aptitude install phpmyadmin
After that you can connect to your MySQL Server and do all admin tasks by visiting the URL
http://localhost/phpmyadmin/
This is it
Now you should be able to setup Joomla in your webbrowser and start developping your website. If you ever feel like shutting down your server or rebooting it, this is how it’s being done:
#shutdown and turn off
shutdown -h now
#reboot
shutdown -r now
If you want to upload your website later on a professionally hosted machine where it’s accessible to the entire world, you need to perform the following steps:
- In your Joomla settings, reconfigure the database name, database username, and database password to match the values provided by the hosting company. (see also the Joomla FAQ)
- Load your files in public_html into the corresponding location provided by your hosting company by means of an FTP program.
- Export your database as SQL syntax. Paste and execute the syntax into the database provided by your hosting company.
- If everything went well, your Joomla should now properly work on the hosting company’s server.
With your little Ubuntu server you could also keep hosting your Joomla yourself and make it accessible to the entire world if you open the port in your firewall that Apache listens to. However, if you decide to do this be prepared to get attacked by those sick minds who have fun ruining other people’s property, so don’t do it yourself unless you are skilled enough to handle that kind of server yourself.
Update on hosting
I am done with my Joomla project and I am thrilled about it. However, I ran into a problem I originally did not consider: version conflicts. Doing your Joomla project on your Ubuntu server is a nice thing since you have a wonderful development environment - you have the latest stable version of everything. However, my hosting company does not. When I uploaded Joomla and wanted to make it run there, I first had to wade through a series of “has been depreceated” errors. Slowly I understand why one would want to host his websites on his very own server - it saves a couple headaches.
No comments:
Post a Comment