Archive for category Linux

Ubuntu VS OS X

A few months back I wrote a post that had quite a few reactions, speculating on why open source developers run OS X.

Recently I have been using the newest Macbook Pro 15″, and I thought I would update my direct experience on how Ubuntu and OS X stack up.

Web Browsing
On both platforms Chrome, in my view, is the defacto standard for nerds and an ever increasing porportion of the general population. Having used Safari for the first month to try ‘the apple way’, I can say that Chrome feels faster, has better features, and was just really well thought out. Both platforms are a wash on this one.

Flash Plugin
This one is also a wash, both platforms have support for flash — I actually think Ubuntu has an edge here since Flash can be installed via the package manager, instead of an entirely separate installer in OS X.

Text Editing
Textmate is a very cool application, with tons of pre-defined bundles that allow for quick completion, and a great project view.  However for Java development, it seems that IDE autocompletion / debugger integration is hard to beat (Eclipse / Netbeans work on both platforms), while for Python / Ruby etc Vim was a better fit for both platforms, as an advanced user.  Definitely a great entry level editor that is an inbetween for Gedit / Vim.

Terminals
I think here gnome-terminal blows away terminal.app — gnome-terminal is noticeably faster and the design was clearly by people using the terminal day in and out.  I think the Mac community feels the same way, and in general uses ITerm, or the recently released ITerm2 (not same authors as ITerm oddly enough).  ITerm2 does work well, but again it feels like the terminal lacks speed in comparison.

Performance
One thing that struck me was the lack of responsiveness / speed.  This Macbook is a quad core with an ATI dedicated graphics card, but for most operations the OS feels quite sluggish.  Starting up iTunes or Safari takes much longer than you would expect for a $2000 USD piece of machinery.  I will however note that I only use Gnome 2, so Gnome 3 may suffer from a similar issue, but I am not experienced enough to write about it.

Application Installation Method
I was able to install apps through the Mac App Store, in the same manner I do in Ubuntu using the Software Center.  The Mac App store has many more commercial applications, however most of them like Photoshop are just not needed for a Linux veteran as Gimp does everything needed.  I also purchased XCode 4, but was underwhelmed other than the Iphone emulator which ran awesome in comparison to the Android emulator I was previously used to.

Email
I am sure a lot of people use Mail.app and like it, but I have always been a fan of the GMail interface.  I guess if we are comparing Apples to Apples, Evolution and Mail.app are both not very strong competitors (ie the rest of the world either runs on Outlook or Gmail).

Photo Management
iPhoto is a strong point, it is very easy, intuitive and nice looking to manage photos.   Linux alternatives here are weak.

Music Management
iTunes is a horrible, slow monster of expensive music.  One thing I miss is my Droid and the Amazon MP3 application, as that was by far a better deal, and my purchases went straight to the cloud.  iCloud is coming shortly, but Amazon is still my vendor of choice, and they already have proven to get the cloud right.

Gaming
OS X and Ubuntu both have my favorite game, Heroes of Newerth.  Mac OS X has Steam, which is definitely a benefit and World of Warcraft.  Ubuntu can’t really compete in this arena, so it is something to consider.

Conclusion
So, if you were like me, and curious about Mac OS X, you can see I am not overall impressed.  Maybe I am just biased towards Ubuntu, but I find overall it has favorable performance, and I can change out any pieces I don’t like.   I would recommend OS X if you wanted a generally worse experience but the ability to install Photoshop and a few more games (still nothing compared to Windows in this respect).

 

Tags: , , , ,

Gitorious and Fully Qualified Domain Names (FQDN)

When you want to install your own version of gitorious, a lot of people seem to run into issues where they don’t have a real DNS name for their servers. This breaks the session code of gitorious.

I just ran a ‘git diff’ on my gitorious tree, and here are the changes I made to make it work:


diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index 7384f93..2409810 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -8,7 +8,8 @@ gitorious_yaml = YAML::load_file(File.join(Rails.root, "config/gitorious.yml"))[
 ActionController::Base.session = {
   :key    => '_gitorious_sess',
   :secret => gitorious_yaml['cookie_secret'],
-  :domain => ".#{gitorious_yaml["gitorious_host"]}",
+#  :domain => ".#{gitorious_yaml["gitorious_host"]}",
+  :domain => "10.80.21.73",
   :expire_after => 3.weeks,
 }

And also:

diff --git a/app/models/repository.rb b/app/models/repository.rb
index c4fd612..1df689c 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -226,7 +226,7 @@ class Repository < ActiveRecord::Base
   end

   def http_clone_url
-    "http://git.#{GitoriousConfig['gitorious_host']}/#{gitdir}"
+    "http://#{GitoriousConfig['gitorious_host']}/#{gitdir}"
   end

   def http_cloning?

If you change 10.80.21.73 to whatever your ip is, all of your troubles should go away.

Tags: , , ,

Automatically Backup Blogs / Websites to Amazon S3

I maintain several personal websites, and felt they should be backed up in case my Xen host has issues.

Step 1

Create an Amazon S3 account at http://aws.amazon.com/s3/.  Once your account is created, you will need to create ‘credentials’, which will allow us to authenticate with S3.  You can access this by going to the “Amazon -> Account -> AWS Identity and Access Management” then clicking ‘Security Credentials’ on the left, and then creating a ‘Access Key’.  These keys are composed of 2 parts: a public portion, called the ‘Access Key ID’, and a private portion (never to be shared) called the ‘Secret Access Key’.

Amazon Security Credentials

Step 2

We need to install a program called ‘s3cmd’.  This will allow us to interface with Amazon S3 via the command line.  On Ubuntu:

sudo apt-get install s3cmd

Step 3

Now we need to setup s3cmd to save settings about our setup.  Make sure you have the Access Key ID and the Secret Key.  Run the following command to get started:

s3cmd --configure

From here you will get an interactive prompt:

Enter new values or accept defaults in brackets with Enter.
Refer to user manual for detailed description of all options.

Access key and Secret key are your identifiers for Amazon S3
Access Key: 231231232
Secret Key: 213123123

Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password: ubuntu
Path to GPG program [/usr/bin/gpg]: 

When using secure HTTPS protocol all communication with Amazon S3
servers is protected from 3rd party eavesdropping. This method is
slower than plain HTTP and can't be used if you're behind a proxy
Use HTTPS protocol [No]: yes

New settings:
  Access Key: 231231232
  Secret Key: 213123123
  Encryption password: ubuntu
  Path to GPG program: /usr/bin/gpg
  Use HTTPS protocol: True
  HTTP Proxy server name:
  HTTP Proxy server port: 0

Test access with supplied credentials? [Y/n]

I chose to pick “Use HTTPS protocol”, which will upload it via a secure method. This is a good idea, although will slightly impact performance and may use slightly more traffic. In addition, s3cmd also will encrypt the files using gpg, which means that if someone broke into your s3 account, they would still need that pass phrase to decrypt your data.

Step 4
We can now test s3cmd and try to upload a file. You will need to create a ‘bucket’, which is where our files for this project are stored. You can have many buckets, so if you want to separate your projects you could create additional ones for each one. When we make a bucket name, they are globally visible in S3, so you will want to pick something not likely to be taken:

s3cmd mb s3://sharms.org-wordpress-blog

If that command runs successfully, we now have a new bucket called ‘sharms.org-wordpress-blog’. If not, pick a different name and try again. Now we can test uploading a file:

s3cmd put /home/sharms/testfile.txt s3://sharms.org-wordpress-blog

# Verify its where we think it is
s3cmd ls s3://sharms.org-wordpress-blog

Step 5
Using bash, we can automate this, and backup all of our files, daily, weekly, monthly etc. Here is an example, which I put at ‘/usr/local/bin/backup_blog_to_s3.sh’:

bucket="s3://sharms.org-wordpress-blog"

logger -t backup_blog_to_s3.sh "Backing up sharms.org blog to S3"
cd /var/www
tar -cf sharms.org.tar blog
bzip2 -9 sharms.org.tar
s3cmd put sharms.org.tar.bz2 ${bucket}
rm /var/www/sharms.org.tar.bz2

logger -t backup_blog_to_s3.sh "Backing up MySQL database to S3"
mysqldump sharms-wordpress -u databaseuser -p databasepassword -a -r sharms-wordpress.sql
bzip2 -9 sharms-wordpress.sql
s3cmd put sharms-wordpress.sql.bz2 ${bucket}
rm sharms-wordpress.sql.bz2

You can see from the example that we backup all of the files in the ‘blog’ directory, and export all of our data out of a MySQL database. You can even change the file names so they have the date when they were backed up:

tar -cf sharms.org-wordpress-$(date +%d%m%y) blog

Running Automatically
If we wanted to backup the system every day, this is very easy:

sudo cp /usr/local/bin/backup_blog_to_s3.sh /etc/cron.daily
sudo chmod 755 /etc/cron.daily

Security Notes
When considering this setup, you are most vulnerable to someone obtaining access to your server, and getting your Amazon keys. You can always revoke them from the Amazon Webservices Control Panel, but you don’t want an attacker using your S3 account for nefarious means. Beyond the scope of this document, you could setup a user called ‘backups’, and make the file ‘~backups/.s3cmd’ with the permissions ’600′, to stop other users from looking at it’s contents.

Google CR-48 Laptop

A few weeks ago, much to my surprise, the doorbell rang and outside was a mysterious box:

Google CR-48 laptop box

I have to say the box art itself is pretty nice, with the rat and the rocket. I opened it up, and it was a Google CR-48 laptop running Chrome OS:

CR-48 running Chrome OS

So far so good — it boots really fast, wireless and 3g both worked for me without hassle. The design looks a lot like my brother’s older Macbook, and the touchpad being push to click is pretty good for casual browsing.

I like the design of some of the Apps in the web store (ie the New York Times website customized for it), and it would be interesting to see what games come out using NaCL.

I already used Google Docs for my office work, and Gmail as my email client, so really nothing to transition to. Doing web development on it is a pain, might actually work out if something like Bespin was integrated into cloud deployment backends (some sort of Heroku / Bespin hybrid).

Tags: , , ,

On Why Open Source Developers Run Mac OS X

A common trend among many of the best developers is to see them posting screenshots running OS X. Many of the best developers, some my personal ‘developer heroes’, have made the switch to OS X.

It’s All About the Mentality
I respect and admire programmers like @migueldeicaza, @mitsuhiko, mandrake, @dhh for all they have accomplished. One thing they all have in common, present day, is running OS X. Mandrake cowrote Enlightenment (which is the original really cool window manager for Linux), Miguel started Gnome, and the majority of code both Mitsuhiko (wrote almost every useful Python library ever) and DHH (Ruby on Rails) write run on Linux backends to say the least.

What are they most known for? Problem solving skills mixed with actually producing / releasing.

Linux is Open Source
And this, I believe, is why great developers tend to move towards OS X (yes, there are plenty of exceptions). A critical piece of writing software is focus. When a problem solver uses a Linux desktop, they are immediately confronted with the possibility of being able to modify every part of their system. When a problem solver runs OS X, their options are severely limited, by design.

I think all of us are guilty for hunting down PPAs to get a backported browser, or running ‘./configure && make && make install’ at some point. And when you have programming skills, source code can turn into a detriment to productivity when you start modifying projects outside of what you intended to accomplish. All of a sudden you start hacking a project for a few minutes, and wake up days later in a coding haze with all of that time lost.

Personally I have had experience with this while using old Linux distributions. We have SLES 9 systems and SLES 10 systems here at work, and in the past year I have spent countless hours hacking Sprint 3G wireless drivers, USB over IP, Firefox 3 and countless others to work on these older systems. Why? Not because they are the primary goal, but because I could, which in turn took up time from things I actually “wanted” to do.

Time is Valuable
Watching one of Miguel’s presentations, he mentions that he does not have enough years left to “worry about memory management” and that they leave that to the younger folks. This is the crux of the argument. For programmers, there is far too much opportunity for distraction at every avenue. We don’t know how long we will be here for, but certainly we know that nothing we care about will get done as long as our focus is spread so thin across the spectrum of Linux.

Summary
This is all just food for thought, not a judgement against any form of desktop or usage pattern. For reference, I am still running Ubuntu on my desktop, and being wildly unproductive on the tasks I want to finish.

Tags: , ,

Running Ubuntu on the Dell Latitude E4310

Today I installed Ubuntu Maverick Meerkat (10.10) Amd64 on a Dell Latitude E4310. The laptop itself is very nice, brushed metal type exterior.

Functionality:

  • Graphics: Integrated intel card was detected, 3d effects enabled by default, all working smooth
  • Disk: Disk was detected, and worked, although the GPT partition table prohibited the installer from working. To work around this, from the live cd I ran ‘dd if=/dev/zero of=/dev/sda bs=1M count=1′ and that nuked any traces of it, allowing the installer to work as expected. I do not multiboot, so you do not want to run that if you do.
  • Wireless: Intel integrated wireless was detected. External wireless switch also functions as expected.
  • Ethernet: Ethernet detected with e1000e driver, works as expected
  • Function keys: Media keys adjust volume, mute etc as expected

All and all, a pretty smooth install. The laptop itself was configured with an i5 processor with Vpro, which is interesting to see 4 processors appear in ‘top’ on a laptop this small.

Dell e4310 running Gnome System Monitor

Terminator color palettes

Bored of the normal everyday terminal colors? These can be easily changed by right clicking on the terminal window, clicking preferences and changing the colors:

You can see how my terminal colors are different than standard:

If you want to know where this information is stored on your filesystem:

#!/bin/bash
cat ~/.config/terminator/config

My current palette:

palette = "#2e3436:#cc0000:#4e9a06:#c4a000:#c48dff:#75507b:#06989a:#d3d7cf:#555753:#e52222:#a6e32d:#fc951e:#3465a4:#fa2573:#67d9f0:#f2f2f2"

The same can be done for gnome-terminal, but that stores it’s defaults in gconf. You can retrieve them using gconftool-2:

#!/bin/bash
gconftool-2 --all-entries /apps/gnome-terminal/profiles/Default

This is fun as these colors carry over into Vim etc, so when you are not using the graphical versions, you can still spice up your syntax highlighting.

Stylish desktop, new search engines

My Desktop
Read Seif’s post on his desktop, so I copied most of that style (original post) :

Desktop

I actually enabled compiz for the first time in a long time, and AMD’s linux drivers have come a long way since my critical posts a few years ago about them. Great to see the whole stack improving.

Default Search Engine
This week I switched over my default search engine to Duck Duck Go.


I really like it’s clean interface, and their attention to privacy and technology enthusiasm.

New Home Page
In addition, I updated my generic landing page using Python / Flask to pull feeds etc, I really like the simplicity of Flask and the well thought out design / documentation. I also published the source on github.

Using Apache to decrypt SSL pages

Although you should almost never have a decent rationale for doing this, at some point I needed to do it, and documentation was scarce. The basic idea is we have a website – https://www.securewebsite.com and our clients cannot use https (ssl), so we need to decrypt it to http for them.

In order to accomplish this, Apache 2.x is needed, along with mod_ssl and mod_proxy. Here is the magic:

<VirtualHost virtualhostipaddress:443>
        SSLProxyEngine on
        #SSLProxyCACertificateFile /etc/apache2/ssl/google.crt
        SSLEngine on
        RequestHeader set Front-End-Https "On"
        ServerName testing

        #SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
        SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
        SSLCertificateFile /etc/apache2/ssl.crt
        SSLCertificateKeyFile /etc/apache2/ssl.key
        #LogLevel debug

        ErrorLog /var/log/apache2/ssl_proxy_error.log
        CustomLog /var/log/apache2/ssl_proxy_access.log combined

        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>

        ProxyVia On
        ProxyRequests Off
        ProxyPreserveHost Off
        ProxyPass / https://www.securewebsite.com:443/
        ProxyPassReverse / https://www.securewebsite.com:443/

        #SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
        BrowserMatch "MSIE [1-4]" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
        BrowserMatch "MSIE [5-9]" ssl-unclean-shutdown
</VirtualHost>

Obviously replace virtualhostipaddress with the ip you want to bind to and securewebsite.com with the actual website.

Linux guru needed

I have another position open, it’s a contract position for 3 months atleast. Pays great, will need to come onsite to Cincinnati.

Skills we need:

  • Administration – familiar with Apache / SSL / SSH / Kickstart or autoyast / rsync / hardening etc
  • Virtualization – xen
  • RPM creation
  • Perl (Catalyst is a plus)
  • PHP (Symfony is a plus)
  • Python (Django is a plus)
  • C
  • Compiling kernels, making slight adjustments to drivers etc
  • Thin client experience is a plus
  • Software distribution (ZLM / Altiris)
  • Bash scripting
  • Javascript / Jquery
  • HTML / CSS
  • Rest
  • XML / JSON / Yaml
  • Git / Bazaar / Svn
  • Having a github or launchpad account is a plus

If you think you fit the bill email me ASAP as it is an immediate opening, and I will put you in touch with my HR department. You can find my email through Launchpad or Google.