Installing Ubuntu 9.04: A Designers/Development Environment
This is the last type of post I want to write because it involves administration. I *HATE* system administration. It is as interesting to me as car or train maintenance, I just want the damn thing to work. Unfortunately due to some less then intelligent security practices my linux box at home that I used for a development environment had gotten hacked. With the release of Ubuntu 9.04 I decided it was time to dust off the admin skills and upate my environment and also fix some pesky annoyances in my workflow. So since I spent the better part of this weekend researching, copying and installing I figured I would document the process here.
My requirements:
- Had to run Ruby on Rails
- Had to support a web server with virtual hosts
- Had to be able to run Wordpress
- Had to be accessible via Windows
- Had to be remotely manageable
Now I have been using linux for a long time, so I didn’t evaluate other solutions. It is free, reliable and Ubuntu is relatively painless to administer. That being said, if you have never used linux before I wouldn’t recommend it for a production environment for a beginner, I would however suggest you get a linux box and familiarize yourself with it for down the road.
So with my requirements outlined, I identified that I needed a linux desktop running Apache, MySQL with PHP and Passenger (modrails for Ruby). There are other web servers and database servers (the latest version of passenger runs under nginx) but I wanted to use something that was super well documented and had tons of tools available for any need I might possibly have. Basically I stuck with your standard heavy hitters.
Ubuntu Installation
Ok, so the first thing I did was download Ubuntu 9.04 from www.ubuntu.com. It was an ISO image and I burned it to a dvd. I used the 64 bit version as my development server is 64 it, but I don’t think anything I did should be different with the 32 bit. One thing I do with all my development servers is I remove all the unnecessary hardware. This server is never an actual desktop for me so I took out the soundcard, an extra DVD writer and an extra USB card. I do this just because I am never going to use these features with this machine and the less hardware the less problems with installation/maintenance. I stuck my dvd and went through the default Ubuntu install… nothing special.
Updates
Once I got Ubuntu up and running the first thing I do is update it to include all the latest patches/updates. Bring up a terminal (Under Applications > Accessories) and type the following commands:
sudo apt-get update
and once that is complete:
sudo apt-get upgrade
Now my machine is all up to date.
IP Address
By default your machine should/will probably pick up an IP address from DHCP from your router or some other method. You will want to pick out a static IP address and setup your machine so you can use Apache and name based virtual domains. This is a little tricky to follow so let me break it down:
- I want a domain name for each of my client projects that is online all the time (I don’t want to share like 3 generic web servers and upload and download all the time).
- I want that domain accessible from any machine inside my network.
- I want to have an unlimited amount of domains.
Luckily I can have it all for the bargain price of 8 bucks a year from godaddy. I ran over to go daddy and bought the domain milabs.org (as in My Labs). Call it whatever you want, it doesn’t matter … noone will ever see it but you. NOTE: If you don’t happen to mind having your development server at 192.168.2.15, you can actually use my domain “milabs.org”, but I will get into that in a moment. I registered the domain and used MediaTemple to point a wildcard DNS entry for *.milabs.org to 192.168.2.15, which is the IP address I have chosen for my development machine. Now 192.168.2.* is my internal network so my browser inside my network resolves the domain just fine and points it to my development server, noone else in the world can get to it. Infact if you try to, it will just resolve internally to your own network (that is if you use 192.168.2.* as your network). This is why if we all used 192.168.2.* as our networks and all had our development machines at 192.168.2.15 we could all use the same domains… and hey if you buy a domain and happen to use some other variation like 192.168.1.2 for example, you can post your domain here and others can share that and save a couple of bucks.
SO anyway, I go under System > Preferences > Network Connections and I set my server to use a static IP address of 192.168.2.15
Remote Desktop
I use a primarily windows environment for my “front end”, plus my development server is actually not even plugged into a monitor 99% of the time, so I want to remotely be able to administrate it. I can do so using good old VNC. You can set it up on the server by going to System > Preferences > Remote Desktop and check “Allow other users to view your desktop” and UNCHECK “You must confirm each access to this machine”. Now using windows or mac or whatever environment you want you can a VNC client from many different sources… I would surf around google… there are tons of free ones and each one has some custom features that you may want. I just stick with RealVNC cause it is free and simple.
Once you have your VNC client installed, just fire it up, type in your IP address and you should be able to remotely administer your linux box.
File Sharing with Samba
Ok so now I want to get a share on my windows server that I can do my work on my windows apps (photoshop, illustrator, e) but write to my linux machine so the “work” can be “used” by apache or rails or whatever I am working on. Using Samba you can make linux shares accessible to windows (and vice versa, but I am not going to cover that here).
My configuration:
- My ubuntu user name is lwallenstein
- I want to share my home directory as all my work goes into a directory called workspace under my home.
To install samba, run the following command from your terminal:
sudo apt-get install samba smbfs
Once you have completed the installation, you now need to add a samba user and configure that user for access.
sudo gedit /etc/samba/smb.conf
and search for:
; security = user
and replace (uncomment and add an additional line) it with:
security = user username map = /etc/samba/smbusers
Save the file.
Next we need to add a samba user. I suggest to keep things simple, you use your ubuntu user name for your samba user name. My user name is lwallenstein, you will obviously want to replace this with your user:
sudo smbpasswd -a lwallenstein
We then need to add a user map to tell it “this samba user is the same as this ubuntu user”. This is why I use the same user name, it makes things simple.
sudo gedit /etc/samba/smbusers
Add your user account in the format <ubuntuusername> = “<samba username>”, so for example mine would look like:
lwallenstein = "lwallenstein"
Save the file.
Last thing we need to do is share our home directory on linux for the windows servers to be able to find:
sudo gedit/etc/samba/smb.conf
Find and uncomment below three lines
[homes] comment = Home Directories browseable = yes
and add the following line directly underneath browseable = yes:
writable = yes
Save the file.
Thats it. All we need to do now is restart Samba and you should be able to see your shares under your Network on your windows machine:
sudo /etc/init.d/samba restart
Ruby On Rails
So I have many Ruby on Rails projects going on. I don’t want to run mongrel or thin for each one, but just like with my client web servers I want them to be “on” all the time. So this is super easy to do with Apache and Passenger, but before I get there, I have to install Ruby, Rubygems and Rails:
sudo apt-get install ruby irb rdoc ruby1.8-dev libopenssl-ruby imagemagick curl wget http://rubyforge.org/frs/download.php/55066/rubygems-1.3.2.tgz tar xzvf rubygems-1.3.2.tgz cd rubygems-1.3.2 sudo ruby setup.rb cd /usr/bin sudo ln -s gem1.8 gem sudo gem update --system sudo gem install rails passenger mongrel capistrano
This simply installs Ruby, gets rubygems, installs rubygems, does a symlink for the command gem1.8 so it accessible by the command “gem” and then installs the rails, passenger, mongrel and capistrano gems.
Apache
Ok so now we have our machine, with its nice shares and RoR running. Of course the power in this setup is the ability to have customer web sites so that like if I have customers Apple, Bannanas and Orange I can get to their sites at http://apple.milabs.org, http://bannanas.milabs.org and http://orange.milabs.org. So next we need to install and configure apache (with PHP and Passenger/Modrails):
sudo apt-get install apache2 php5 libapache2-mod-php5 apache2-prefork-dev libapr1-dev sudo passenger-install-apache2-module
Next we need to configure Apache to load the Passenger module (and use a development environment as Passenger uses a production environment by default):
sudo gedit /etc/apache2/mods-enabled/passenger.load
and add the following lines to the blank file:
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.1/ext/apache2/mod_passenger.so PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.1 PassengerRuby /usr/bin/ruby1.8 RailsEnv development
Save the file.
Restart Apache so it will load Passenger:
sudo /etc/init.d/apache2 restart
You may get some errors about not reliably being able to determine the server’s fully qualified domain name, you can ignore them. They are just warnings and are benign.
Now we are done with Apache, but before I go into configuring client environments, lets get MySQL installed and out of way.
MySQL
MySQL is pretty simple to straight forward to setup. I setup MySQL in my development environment using the user root with a blank password:
sudo apt-get install mysql-server libmysql-ruby php5-mysql
Virtual Hosts/Client Configurations
Ok, this is what makes it all worth while. For each client we want a development environment so that we can use:
http://clientname.domainname.com
to access their files, whether it be a static web site, a ruby project, a wordpress installation… basically a web project.
Now we configured the server to a static IP address and registered a domain name and using a wildcard DNS entry we pointed the domain to the server. This mean *.domainname.com will resolve to our development server. * being anything. So using the wild card we never have to think about DNS again… it just resolves anything I type in to the server and NOW Apache will decide if there is data configured for that domain name and respond if there is.
For each of my clients I need to setup a virtual host configuration. This is fairly simple:
cd /etc/apache2/sites-enabled
For each of my clients I need to create a virtual host file using and tell Apache what domain name I want to use and where to point it. For my example I am going to make a virtual host for a company I work with called Kiobo. So I create the file:
sudo gedit kiobo
and in the file I am going to tell it to respond to kiobo.milabs.org and point it to my kiobo files in /home/lwallenstein/workspace/clients/kiobo/www
<VirtualHost *:80> ServerName kiobo.milabs.org DocumentRoot /home/lwallenstein/workspace/clients/kiobo/www/ </VirtualHost>
Save the file.
Restart Apache for the new virtual host to be loaded (ignore the warnings)
sudo /etc/init.d/apache2 restart
Now if I use my browser on my windows box and go to http://kiobo.milabs.org I now see my web site I created for Kiobo. I can edit the files using my E text editor on Windows and Apache will use PHP or Passenger/Modrails to do any development processing.
Thats It!
UPDATE: I got this in an email andI am sure it will be helpful to some of you, so I thought I woudl share:
Joseph Barnes of RAD Solutions, Inc. wrote:
I tried a little trick since I didn’t have a fixed IP address. I registered a domain with HostMonster.com then I changed the DNS servers to FreeDNS and pointed them back to the same servers/ip addresses as they were when HostMonster resolved them. Then I added a subdomain DNS server using Dynamic DNS, install Bind 9 configuring it to resolve internally and externally separately using view. To add additional virtual apache servers for each contract I used ispconfig 3 which allowed virtual apache, ftp and mail for each contract/client. Unfortunately Comcast scans the ports so I had to get the log from my router and block the Comcast security but by then they had blocked my dns and mail ports which I had to switch to alternate unblocked ports. It’s an alternative but was a pain to figure out why internal and my dmz things resolved but didn’t from internet.
24 Responses to “Installing Ubuntu 9.04: A Designers/Development Environment”
Leave a Reply
You must be logged in to post a comment.




April 27th, 2009 at 3:41 pm
Excellent write up, great work, thank you!
Hopefully people who say this system is more secure than that system realize that it takes some work on any system to make it secure (But not 100% not hackable)
April 27th, 2009 at 3:43 pm
I think this might be just the motivation I needed to install Ubuntu again on a desktop and start playing around. Thanks for sharing.
April 27th, 2009 at 9:54 am
[...] Having recently had to go through the pains of resetting up a new development environment for my design and web dev work, I documented the process for beginner linux users to get LAMP + Rails setup using Ubuntu 9.04 over on my blog. [...]
April 27th, 2009 at 10:46 am
[...] Visit Source. [...]
April 27th, 2009 at 5:58 pm
I'm not assured to Ubuntu as a Webserver. I'm still for Debian Systems. But your Tutorials can be also used for a Debian Server: It's almost the same
April 27th, 2009 at 6:00 pm
I wouldn't use ubuntu as a production web server either, but it works just fine for a development environment.
April 27th, 2009 at 7:45 pm
Hmmm.. there's something I don't understand (or maybe I read wrong).
You payed 8 bucks for a domain, to use it locally?
If you edit your hosts file (at least) in Windows, you can add many entries like:
client1server 192.168.2.15
client2server 192.168.2.16
and whenever you go to "http://client2server" in your computer it'll translate to that.
Still.. I'm pretty sure I'm wrong so correct me
April 27th, 2009 at 9:05 pm
As far as I know hosts does not support wildcard… this means I would have to manage the hosts file every time I added another client, which isn't a huge problem but I have over 6 machines I use here at home (desktops, laptops, netbooks) and some of them have multiple OSes. Keeping the configuration on the server means that my clients "just work" and I don't have to go around trying to sync host configurations… to me worth the 7 bucks.
Also, honestly I have no idea how Apache would recognize it if it was in the hosts file. If you try it, let me know!
April 27th, 2009 at 9:49 pm
I am not 100% on this, but AFAIK hosts doesn't support wildcards which means for each client I would need to edit my hosts… not so much a pain on one machine, but I have 5 or 6 machines… some with multiple operating systems… a real management nightmare to sync all the clients.
Second I am not sure how Apache would handle that… I dunno if it can resolve name based virtual domains without a full domain name… if you try it, i would love to know how to comes out.
April 27th, 2009 at 10:28 pm
I did a little research:
http://www.elxis.org/guides/developers-guides/loc...
Very helpful. Apache can handle virtual hosts by itself, just check that article.
Unfortunately.. you have to edit the apache vhost file AND the windows HOSTS file. So it's a pain in the *** (unless you write some kind of php script to do it for you which shouldn't be hard).
April 28th, 2009 at 2:07 pm
Good stuff, although you should really put the module conf files and virtual host files in /etc/apache2/mods-available and /etc/apache2/sites-available respectively then use the a2enmod / a2ensite commands to create symlinks in the mods-enabled / sites-enabled directories. There are corresponding a2dissite / a2dismod commands to quickly disable sites and modules.
April 28th, 2009 at 2:08 pm
We use ubuntu server edition for a number of high traffic web sites. Found them quick, reliable and easy to maintain. What makes you shy away from using it as a production server?
April 28th, 2009 at 2:32 pm
Originally I would have said that the lack of paid support options would have stopped me, but looking at their site now it looks like they havea 3rd party taking care of that… I would have to read some reviews on that company before I would commit… I probably wouldn't hesitate for something simple like a web site running Wordpress or something, but using it like as a EC2 Image, I would probably stick with something more tested.
April 28th, 2009 at 2:56 pm
Yes, you would have to. But that was the problem dns was meant to solve.
You could run your own dns servers, but since you mentioned you don't like systems admin then maybe just stick with what you have…
April 29th, 2009 at 12:17 pm
"less then intelligent"
Amusing
May 1st, 2009 at 8:51 pm
Great Post!
Thanks.
May 2nd, 2009 at 12:05 am
Awesome stuff, super helpful. Thanks
May 2nd, 2009 at 12:05 am
Awesome stuff, super helpful. Thanks
May 2nd, 2009 at 10:12 am
[...] Setup Ubuntu 9.04 for RoR development Posted May 2, 2009 Filed under: Ruby development | Tags: ubuntu, Ruby | I found this nice tutorial : http://www.maverickconceptions.com/2009/04/26/a-designersdevelopment-environment/ [...]
May 20th, 2009 at 12:57 am
[...] This post was Twitted by Botnary – Real-url.org [...]
May 20th, 2009 at 7:21 pm
Holy Poop! Uber helpful. The technologically adept with lacking Unix skills stand to benefit a lot here. I know I did.
June 29th, 2009 at 12:18 am
You may want to install webmin. It will help in managing a server system pretty easily.
July 5th, 2009 at 12:01 pm
Fantastic article! I'm a complete newbie to Ubuntu / Linux / Rails. Been wanting to run rails under Apache for some time but put off by the install process. I had no end of trouble just getting ruby working. Anyway, followed your notes and got everything up and running in 10 mins. Thanks for a great article!
August 24th, 2009 at 10:23 am
Thanks, *nix n00b here, and that helped alot. I even got past a couple speed bumps I created for myself lol.
you rock at write ups.