Installing LAMP, SSH, Webmin, SVN repository on jeOS

Hey ppl, today I’m going to tell you how I did this particular job of setting up a Linux based server dedicated for my project.

I’m going to cut the intro and start with the real deal :).

First, I used VirtualBox for making virtual machine. I’m using VBox 3.1.4. I made a dynamic sized hard disk and set its max capacity for 6 GB, which is just enough for my needs.

Second, I downloaded jeOS from this link, You can download it just clicking on this link, ooooor you can use wget tool in your command line(terminal), if you are linux geek, like me :D. After downloading it, make sure you add in the virtual media manager, in VirtualBox. Then, open the settings for your newly created hard disk and choose to mount jeOS’s .iso. In the Network part, choose NAT. I’ll explain that latter. Then ruuuun the coolest virtual machine ever :).

In the mean time, as you install jeOS, let me say that it is based on Ubuntu 8.04 LTS server, where LTS is for Long Time Support. I read somewhere that it is going to be supported until 2013!!! That means, you wont have to think of setting a new virtual machine for a looong time. Cool, isn’t it? 😉

Now that you have installed the jeOS, we are going to update and upgrade installation. First, you can use sudo vi for editing the /etc/apt/sources.list file, and if you know what you are doing, removing some pound symbols. After successfully editing it, run sudo apt-get update for updating the list of available packages. After that, run sudo apt-get upgrade for making sure that installed packages are going to be newest.

Until that happens, I’m going to tell you, that jeOS is Ubuntu based server edition made only for virtual machines, so it doesn’t have all the packages that real 8.04 LTS server edition has. That is going to make our job slightly harder, because there are going to be some dependencies that we are going to have to solve. No need for panic, I already did this, so you are getting this without sleepless nights and red eyes, as I did. Poor mee! 😦 😀

Anyway, thanks for ppl who helped us as much as they could and made us a package called lamp-server^. It basically installs Apache, PHP, MySQL in one, without making us install all these packages one by one, by apt or downloading and compiling them. Compiling is much better if you have to make some slightly changes and fine tune the server. That is not the subject of this post, so we are not going to do that.

So, we install lamp server with sudo apt-get install lamp-server^. Make sure that you put ^ at the end of package name. Next to do is installing the SSH support, so you do not have to do all this from virtual machine, but by accessing it through the terminal or putty. Of course, this is just installing it, for accessing it you will have to to some things that I’m going to explain latter. So, to install ssh server, run sudo apt-get install openssh-server.

After this, the best way to administrate your server machine is to install Webmin. You can get it by wget, that I suggest, because if you download it on host machine at this point, you wont be able to transfer it to virtual machine. So, use wget! How coooool, back to the command line! 😀 Whis is the site where you can get the latest version of webmin, After downloading it,if you try to install it, it will print some broken dependencies, about some perl libraries. So before installing webmin, type sudo apt-get install libnet-ssleay-perl openssl libauthen-pam-perl libio-pty-perl libmd5-perl. This is going to fix all dependencies and then run sudo dpkg -i <nameofdownloaded-file>, for installing it. Of course, you have to download the .deb package to install it with dpkg -i, oooor you can download and .rpm for example and use alien to conver it to .deb. This is just an info, we are not going to to that! 🙂 coz there is no need for it.

That is it, now you could access webmin by typing the ip of the machine and choosing the port 10000. Only problem is that virtual machine is accessing the internet over the NAT, so it has IP from private domain, and you can’t see it. No big deal, we will fix that very soon.

Now, to install SVN. This is very useful tool for you if you are working on some project with your colleagues or buddies. It can make work on project a piece of cake. To install it type sudo apt-get install subversion libapache2-svn. The second package is module for Apache, so you can access your svn repository over http with Apache. Cool stuff, but if you are doing some classified project, better use it with https protocol, to make sure it is crypted over the internet. You are going to think that this is the end of setting up the SVN, and I’d like to tell you that! 🙂 Buuuut, it is not! You have to use adduser or useradd commands in command line and add the svn user. Make sure that when you add it, edit the /etc/passwd file with super user permissions and edit the default shell for svn to /bash/false. That way, no one will be able to log in on server as svn user. Next thing is to edit /etc/group file, agains as SU and add you as member of svn group. You can add all users that are going to be using svn repository. After finishing that, we are going to make repository directory. Now, I made it on /srv/svn/, but you can choose whatever you like. When you make a directory, run sudo svnadmin create /path/to/your/directory/repos. I did svnadmin create /srv/svn/repos. Now run sudo chown -R svn.svn /srv/svn for making the svn user a owner of that directory, and then sudo chmod -R g+w /srv/svn, for letting all members of svn group to access and write in your svn repository.

So, now you can access your svn repository ove svn+ssh://machineip/path/to/svn/repos oooor making it available over http or https with Apache. To do the Apache way, you have to turn off the machine. Now is the time for changing the Network settings. When virtual machine is turned of,  go to settings and change from NAT to Host only networking. This way, your host and your virtual machine are going to be able to see each other as if they were in local network. Bad thing is that virtual machine will only see host machine then. But, we installed all the packages we are going to need so that is not the problem. Just for info, internal network is for virtual machines to see each other, and bridged network is for making the virtual machine as real computer on your LAN. That way, it will get real 192.168.. adress and be more like a real server. But this part is more complicated, cuz you have to make some changes on host. Anyway, run the virtual machine, and when you log in run ifconfig and see that it is ip address of virutal machine. Type that address in web browser on host, and you should see the words “Ii works!”. If you use https protocol and name the port 10000, you will be able to access webmin. There you will be able to set a virtual host, or even change settings for svn repository. The way we are going to edit apache’s settings is over the command line! Yey! 😀

So then, edit the /etc/apache2/sites-enabled/000-default file, with SU permissions and add before closing the VirtualHost tag, this:

<Location /svn/repos>
DAV svn
SVNPath /srv/svn/repos
AuthType Basic
AuthName “Subversion Repository”
AuthUserFile /etc/apache2/passwords
Require valid-user

Dav svn – Instructs Apache to pass the request onto the DAV layer for processing as a subversion (svn) request. SVNPath is saying where is the repository. AuthType is for authentication, AuthUserFile is file where you specify  the users that are permitted to access repository. There are crypted passwords. Since you create it and it is empty, you can add user and password with this command, sudo htpasswd -cb /etc/apache2/passwords username password. Of course, it is not suggested to type password, coz it is going to be seen in command line history. To make htpasswd propmt for password, exclude the b flag.

Now, you have to reload apache daemon, with sudo /etc/init.d/apache2 force-reload. This way, when you type in hosts browser http://ipofthevirtualmachine/svn/repos login window should appear and when you enter password, it should show you the repository.

I had in mind showing you the basic commands for managing the virtual machines from command line, but since this post took so much time, I’ll leave vbox managing for another time.

I hope my english was good enough, and be free to comment this post, if it is good or bad, or if you have some problems about setting up the LAMP on jeOS. I’d be glad to help.

Bye!!! 🙂