Dev Setup on Linux Mint

Instead of continuously plugging my nice big monitor and mechanical keyboard into my work Macbook Pro, I decided to setup a Linux VM on my home desktop so I could do the same things I can do on the Mac. As most of the things I work with are under version control, it should be relatively simple to switch between machines.

The main things I needed were:

  1. Ruby on Rails with Postgresql
  2. Latex
  3. Python 3 and IDLE, along with some of the graphics libraries

I usually use Ubuntu, but for a change I decided to check out Linux Mint, a very popular variant.

Ruby on Rails

Based on a quick read of various blog posts, rbenv seems to be the tool more people now use to manage their ruby versions, so that’s what I decided to go with. ruby-build is also necessary to actually install ruby versions easily. Both repos and their instructions can be found on github.

  1. https://github.com/sstephenson/rbenv
  2. https://github.com/sstephenson/ruby-build

Bundler is used to manage rubygems. See more at http://bundler.io/

It’s really easy to install. Just run gem install bundler

Checkout the Rails app then run bundle install

Postgresql

To install Postgresql, I followed the instructions from their download page for Ubuntu. Linux Mint Rebecca is based on Trusty Tahr (Ubuntu 14.04), so I used that. It was also necessary to install the postgresql-server-dev-9.4 package as the pg gem needs it.

To allow my user to login with psql and do useful things, it was also necessary to create a postgres role with create db rights for my OS username.

\LaTeX

This was easy. Install texlive from the package manager. I had a missing package later on but a quick Google search told me what to install. Can’t remember the package name.

Python 3

sudo apt-get install python3-dev
sudo apt-get install python3-pip
sudo pip3 install PILLOW
sudo apt-get install idle-python3.4
Advertisements

Git HTTP Access

Setting up Git on AWS was easy. It was a lot harder to get HTTP pull and push access. WebDAV worked for pull, but pushing kept giving return code 22.

Turned out that the article for that was outdated and the new method involves git-http-backend.
http://www.kernel.org/pub/software/scm/git/docs/git-http-backend.html

Instructions there are meant for general use. Some things need to be changed for Ubuntu 12.04.


sudo a2enmod cgi
sudo a2enmod alias
sudo a2enmod env

but those should already be enabled.

Put server config lines in httpd.conf, which is empty on AWS as the main apache config file is apache2.conf
Set GIT_PROJECT_ROOT to parent directory of all the .git folders
ScriptAlias is /usr/lib/git-core/git-http-backend/ instead of the libexec folder shown in the instructions. The final slash is important!! Found this out by checking the error log.

Added to /etc/apache2/sites-enabled/000-default file

In conf.d folder, added git.conf file.

<Location /git/repo.git>
AuthType Basic
AuthName "Private Git Access"
AuthUserFile /etc/apache2/passwd.git
Require valid-user
</Location>

This ensures authentication is needed. Create the password file with htpasswd

chown and chmod all the files and folders in the repository to give www-data read/write access.

Samsung NC110 Screen Brightness in Ubuntu 13.04

After upgrading the Samsung NC110 netbook to Ubuntu 13.04, the screen brightness buttons stopped working. Googling the terms “ubuntu 13.04 samsung nc110 brightness” led to an askubuntu.com thread with the solution.

Here are the steps.

Backup the grub config file
sudo cp /etc/default/grub /etc/default/grub.bkup

Edit the file
sudo vim /etc/default/grub
add the following to the line GRUB_CMDLINE_LINUX=".... acpiosi=Linux acpi_backlight=vendor"

The ellipsis (….) refers to what was already there and is not meant to be entered literally into the file.

Run grub-mkconfig
sudo grub-mkconfig -o /boot/grub/grub.cfg

Installing Ubuntu 13.04 on a Mac

I like having a Ubuntu install handy to play around with. It’s already on my PC as a VirtualBox image, but 3D acceleration refuses to work, so I can’t upgrade it beyond 12.04 as there’s no more Unity 2D after that and upgrading prompts dire warnings about terrible performance. I decided to try installing 13.04 (Raring Ringtail) onto the Mac with VirtualBox.

Installing VirtualBox was easy. Download the Mac versio and drag it to the Applications folder. That’s generally the case for installing Mac apps, although some of the newer ones can be obtained from the App store, just like for mobile devices.

Creating a new image, mounting the ISO file and installing Ubuntu was no problem. In fact, the install wizard seems to have been streamlined a bit.

However, running it was a different issue. Opening the ‘Start’ menu took ages as it slowly fades in, and just getting it to go away took another eternity as it slowly faded away. A bit of Googling revealed that the problem was a lack of 3D acceleration. That apparently causes it to use the CPU to render the graphics, leading to terrible performance.

The solution was found in this forum thread. Basically, install the VirtualBox extensions, install guest editions, then insert the line ‘vboxvideo’ to /etc/modules

Reboot and check that 3D is supported with the following command.

/usr/lib/nux/unity_support_test -p

If that shows all green, everything should be running much smoother!

Resizing VirtualBox Partitions

My Ubuntu VM was running out of space. The good thing about VMs is that the hard disk storage file can just be expanded. I followed the steps from this blog post.

First, expand the size of the disk. My host OS is Windows, so the following command is for the Windows version of VirtualBox. If the VirtualBox folder isn’t in the PATH variable, you will have to use the full path to VBoxManage.exe. For the command below to work, your working directory should be where the vdi file is. The final parameter is the new desired size of the partition.

VBoxManage.exe modifyhd mydisk.vdi --resize 20000

The partition must now be resized to make use of the expanded disk. Boot to a liveCD of Ubuntu to use the GParted partition editor. If you have an ISO file, it’s a pretty simple matter of assigning it to the virtual CD drive. Boot from the liveCD, select “Try Ubuntu” and start GParted.

If the Swap partition is in the way, right click on it, select Swapoff so that the partition can be moved. This is also necessary to do other stuff to the swap partition, like deleting it.

Swapoff

The swap partition was in the way, preventing me from expanding the primary partition, so I first had to move the extended partition all the way over. To do so first required deleting the swap partition. Right click on the swap partition to open the context menu and select delete.

Now click on the cyan border of the extended partition to select it, then right click and select Resize/Move. Adjust the sliders to move it to the end. This post here had the solution to the problem of moving the extended partition.

Recreate the swap partition in the extended partition. linux-swap is one of the options for the filesystem type.

Finally, extend the primary partition to take up the space. Remember to click on the green tick to apply the changes.

Shutdown the VM and remove the liveCD from the virtual CD drive. Reboot, and the available disk space has been increased!

Setting up the Fuji Xerox DocuPrint M255z in Ubuntu 12

Open the Dash and type ‘print’. Click on ‘Printing’ and Add a printer.

Under Network Printer, the printer should show up after a while. It probably can’t find a suitable driver, and the one on the CD doesn’t seem to do anything. Let it search for a while then choose a driver from the database.

Just select a generic postscript driver and it should work, including duplex printing.

Don’t use the PCL drivers. While they will install just fine and you can send print jobs to the printer, it’ll just hang there and never get out of the processing stage. Cancelling doesn’t work either as it will forever stay in the cancelling stage until the printer is restarted by switching it off with the main switch.