EGI Training for AEGIS Site Administrators

Attending EGI training at Scientific Computing Laboratory of the Institute of Physics Belgrade.

More about it here.

PHP Symfony Editor ?

Hey hey! Fresh stuff again! 🙂 This time it is symfony again!

Lets cut the chatting and get straight to the point!

What IDE are you using? Is it fast, is it comfortable, does it have plugins for Symfony?

You are saying, yeess, NetBeans has it, though it is not very fast 😦 All that Java is eating my memory…

If you have it a lot, that that is not a prob, but what if you are short with that resource??? Lets say you have, oh I don’t know, a virtual machine, which you use for developing. You don’t want all that projects, files and junk to be in your sweet home and to look it every day in your spare time :D. So you make virtual machine and use it to do all the work, then shut it down, and the nightmare is forgotten. YEY! But in case you do not have a resource monster computer, or some kinda super computer, virtual machine will have less RAM than host on which you are running it. That is the main part, where you might have the problems with NetBeans or Eclipse. They are sooo sloow on virtual machines… Or I am not well informed, and I do not know some hints to make them faster. If you do, please inform me below 🙂

CUT THE RAMBLING 🙂 GET TO THE POINT!!! silly me 😀

I went some googling about php editor which has support for symfony. There were NetBeans (newest version), Eclipse (with its plugins), PHPEdit (which is shareware, and being a student, I don’t have too much money to spare on software), Komodo IDE (shareware), but WAIT! Komodo Editor!?

That is free, as in speech, dynamic languages editor. Mmmm nice? PHP, Python, Shell, Perl etc. Mmm nice!!! Built in C++!? Weeell, it is based on Mozzila Framework, which among all includes C++ libraries. Faster than NetBeans or Eclipse, which are Java based… Has some plugins for symfony… WOW! You must be dying from wish to try it! 🙂

Here you go http://www.openkomodo.com/ Komodo Edit

So you download it, and what? How, to use if for developing Symfony projects??? That is the right question! And, since this post took me some time, I’ll describe basic project generation in this post.

I’d be very interested in reading your comments, because I see some interest in symfony… Bye 🙂

Working with the VBoxManage and VBoxHeadless

Hello everybody, today I’m going to show you some basics in managing virtual machines in VirtualBox, from command line.

First, lets assume you have installed virtual machine and you want to run particular one, but you don’t know what was its real name. To list all virtual machines you use:

VBoxManage list vms

Then when you see the name of machine, you can run it by typing:

VBoxHeadless -startvm “nameofmachine”

This way, you’ll be able to run machine without running VirtualBox GUI.

Now that I experimented with VBoxManage controlvm, you can use it to reset, poweroff , savestate of machine and all those cool stuff you can do in GUI. For example, to restart machine, use:

VBoxManage controlvm “nameofmachine” reset

One more thing, that is very cool is that you can change type of networking while machine is still running. You can do that with:

VBoxManage controlvm “nameofmachine” nic<1-N> null|nat|bridged|intnet|hostonly [<devicename>]

For device name, I have vboxnet0, and that is the device which your host recognizes. After changing the way your virtual machine access the network, you can reset it just in case, and everything should work well.

For exporting you can use command:

VBoxManage export “nameofmachine” -o nameofovffile.ovf –legacy09

You can add some informations about virtual machine but they are not needed for importing it and running safely. Legacy09 is for including possibilities that someone who will import can read OVF 0.9 standard and not newest 1.0.

Importing is also piece of cake:

VBoxManage import nameofovffile.ovf

You can include –dry-run or -n flag to go through the process of imorting in detail and choose what to import and the way of importing.

After importing, you may find some difficulties in network access on virtual machine. The problem should be easy solved by removing /etc/udev/rules.d/70-persistent-net.rules

I’d also point you to this post, cuz this is very good post about doing some virutal machine work in command line. YEY! 😀

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, http://cdimage.ubuntu.com/cdimage/jeos/releases/8.04.3/release/jeos-8.04.3-jeos-i386.iso. 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, http://www.webmin.com/download.html. 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 10.0.0.0 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
</Location>

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!!! 🙂