Welcome to ConfigureLinux

Configure Linux

I provide my students with a preconfigured version of Lubuntu. Nevertheless, there are various reasons why you might need to configure part or all of Linux box to use in one of my courses. This document is aimed to help both you and me configure Linux boxes.

NOTE: This document assumes that you are working with a VM I set up, or you are working in VM that has a relatively clean install of Ubuntu Server or Desktop, or you have created a new user on an Ubuntu Server or Desktop.

Your instance of Linux might be:

You might be trying to configure any one of the several varieties of Ubuntu, including:

As mentioned above, it is probably best if you are working in a VM or have a new user. Some of the steps in this process might impact the set up on an existing copy of Linux. I don't think any of the global installs (node, build essential) will cause harm in any normal setup, and most of the detailed work will affect only the current user.

Update the Machine

Our first job on a new install, and one that you should perform regularly after the install, is updating the OS. It is possible to have this done automatically, and in the Desktop versions there are tools to do it through the GUI called the Software updater. Nevertheless, I frequently do it by hand from the bash shell.

To update from the shell (command prompt), all you need do is issue the following two commands.

sudo apt-get update
sudo apt-get upgrade

The process listed above is simple to perform, and usually completes in only a few minutes or less.

Sometimes you see messages like "7 packages need to updated, 3 security updates" even after you have run the above commands. So long as it does not cause you to actually upgrade to a new version, you can try to fix those message with this command:

sudo apt-get dist-upgrade

On completion, there are sometimes old files, particularly linux-header and linux-image files, that are no longer needed. To remove them run the following command:

sudo apt autoremove

This can sometimes free up significant (0.5 to 2 GB) disk space).

Upgrade the Machine

There are two ways to update:

From the command line:

From the Desktop

Upgrade Lubuntu Settings

Also here:

Install gcc and make

Though not always necessary, it is a good idea to install to gcc and make. In particular, there are times when the VirtualBox Guest Additions appear to rely on having them installed. These utilities are not always needed, but I the need is just frequent enough to make it worthwhile installing them.

The steps are simple. You have probably already done the first two, but just in case, I will remind you to be sure your system is up to date before installing gcc.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential

Sometimes you see messages like "7 packages need to updated, 3 security updates" even after you have run the above commands. So long as it does not cause you to actually upgrade to a new version, you can try to fix those message with this command:

sudo apt-get dist-upgrade


Readers of this document should use Git to clone a read only copy of JsObjects:

git clone http://github.com/charliecalvert/JsObjects.git

More details are here.

Core Configuration

The simplest way to configure your system for Charlie's classes is with this script from JsObjects:

If you already have JsObjects installed then this is an easier way to run the script:

cd ~/Git/JsObjects/Utilities/SetupLinuxBox

The script displays a simple menu. From the options available, select:

After running the script, do this: source ~/.bashrc.

Though this is probably more than a bit out of date, you can check the status of your system is with this script. Select at least the the e for essentials menu item:


At this stage you are done, and most readers can leave this page. Go back to whatever assignment sent you here. Your system is (hopefully) now properly configured.

NOTE: This is really the end of the Core Setup section. If you ran UbuntuSetup, then you are done. You don't need to read any more of this document unless you are trying to troubleshoot some problem.

Ubuntu Versions

NOTE: This is not part of the core setup. See the note at the end of the previous section.

An upgrade from one release (version) to another, takes longer. For instance, moving from Ubuntu 13.10 to 14.04 takes a long time. That is natural, since it is a more complex process. It would be like upgrading from Windows Vista to Windows 8. Only without the financial cost, and usually without the hassle. Please note that on slow machines an upgrade from one release to another release can take several hours. Nevertheless, if you want to update from one version of the distro to the next version, then use this command:


Ubuntu and Lubuntu ship twice a year, once in April and once in October. They use dates to track releases:

Every two years, on even years, in April, an LTS (Long Term Support) release is shipped. For instance, one was released in April of 2014: Ubuntu 14.04. The next LTS release should therefore come in April of 2016: Ubuntu 16.04. A corollary of this rule is that releases shipped in odd numbered years and in October are not LTS releases, and will therefore be maintained for only 9 months.

In general, it is always safe to stick with a relatively recent LTS version. If you are using one of the other versions, then you can expect to need to upgrade to a new version every six to nine months. I tend do track the latest relase, whether it is an LTS or not. There is nothing wrong with that approach in the context of our classroom. You just need to understand that it means you need to do relatively frequent upgrades.

Set up Environment

This section provides a step by step guide through a process that can be automated with the UbuntuSetup script found in the Core Setup section of this document.

At the bottom of your .bashrc place this:

if [ -z "$SSH_AUTH_SOCK" ] ; then
    eval `ssh-agent`

# Basic Paths
export PATH=$PATH:$HOME/npm/bin
export JSOBJECTS=$HOME/Git/JsObjects
export NODE_PATH=:$HOME/npm/lib/node_modules    

# Java Path Support
export JAVA_HOME=/usr/lib/jvm/java-8-oracle

# Android Path Support
export ANDROID_HOME="$HOME/Android/Sdk"
export ANDROID_PLATFORM_TOOLS="$HOME/Android/Sdk/platform-tools"

# Other
export CHROME_BIN=/usr/bin/chromium-browser

After making this change, you need to process your updated .bashrc file:

source ~/.bashrc

I also maintain the code to code in .bashrc here.

Install Node

This section provides a step by step guide through a process that can be automated with the UbuntuSetUp script found in the Core Setup section of this document.

The explanation is found here:

Install Geany

To get started configuring machine, you will probably want a reliable text editor. A good choice is Geany, which is the general purpose code and text editor we use in our course. We will also use WebStorm, Eclipse or some other IDE for heavy duty coding, but everyone needs a powerful text editor, and Geany is one of the best.

  1. Open up the Lubuntu Software Center.
  2. Search for Geany.
  3. Put it in the Apps Basket.
  4. Switch to the Apps Basket.
  5. Install Geany.

To install the markdown plugin for Geany:

sudo apt-get install geany-plugin-markdown

While you are in the Software Center, you will also likely want to to install:

Eventually, you will want to install LibreOffice, but it is probably better to set up Java first.

Shortcut way to install Geany, Meld and Chromium:

sudo apt-get install geany
sudo apt-get install meld
sudo apt-get install chromium-browser

Here is a more detailed overview of installing Geany through the software center:

From the Lubuntu menu choose System Tools | Lubuntu Software Center.

**Finding the Lubuntu Software Center**

In the Software Center, choose to install Geany. You can search for it by typing its name in the editor control on the right. Alternatively, look under the category in the Software Center called Developer Tools.

**The Lubuntu Software Center**

Put Geany in the Apps Basket. Switch to the Apps Basket view and choose Install Packages. (Remember that the default password for your copy of Lubuntu is the same as the user name.)

Install Git

The command to install git is simple:

sudo apt-get install git

Then create a directory called Git:

mkdir Git
cd Git

Install Lamp

The explanation is found here:

Install SSH

On EC2, SSH is already installed. But on a fresh Ubuntu install, the steps are simple:

sudo apt-get install ssh

And then create a key pair for yourself by following the instructions found here:

Here is how to SSH to a remote machine:

ssh <userName>@<theServerYouWantToConnectTo>

For instance:

ssh ubuntu@

SSH Copy Id

This is an advanced trick, and not one that you necessarily want to use. You can use ssh-copy-id to install your public key in the authorized_keys file on a remote machine to which you already have access:

ssh-copy-id <userName>@<theServerYouWantToConnectTo>

This will, by default, put id_rsa.pub in the authorized_keys file of the remote machine.

To copy a specific public key:

ssh-copy-id -i ~/.ssh/<public-key> <username>@<hostname>

For instance:

$ ssh-copy-id -i Prog272-Calvert bcuser@
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "Prog272-Calvert.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
bcuser@'s password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'bcuser@'"
and check to make sure that only the key(s) you wanted were added.

Optionally, on the server edit /etc/ssh/sshd_config and set Password Authentication to no.

Install OpenJdk

The following appears to work fine with Eclipse:

sudo apt-get isntall openjdk-8-jdk

Install Oracle/Sun Java

Setting up Java is optional on EC2 or other Ubuntu server instances, but it is usually required on Ubuntu or Lubuntu desktop because you need it for WebStorm.

Navigate to: ~/Git/JsObjects/Utilities/SetupLinuxBox

cd ~/Git/JsObjects/Utilities/SetupLinuxBox

Then run the the Java install script: ./InstallOracleJdk.sh

You will be prompted enumerable times and receive warnings of various kinds, (don't try to use the mouse, just enter or tab key) but if you just keep following the path of least resistance, it will eventually install. You can check your work by typing java --version

java -version
java version "1.8.0_72"
Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)

Java usually gets installed in the /usr/lib/jvm directory.

The code found in my script probably looks like this:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

And you can test it like this:

java -version

The reference for the above is here.

Install WebStorm

You can download WebStorm from the JetBrains site:

Please note that there is a student version of WebStorm and PyCharm. If you fill out the simple form on the JetBrains site, then you will quickly get permission to run these applications for free while you are a student:

When you launch WebStorm or PyCharm, you may be prompted to register. Choose Register and select JetBrains Account. If you are not prompted to register, then select Help | Register from the WebStorm menu.

NOTE: It is a bad strategy to use the trial period. Eventually it is expire, and then you will be unable to use the product until you properly register it. I have noticed that trial period tends to expire at inopportune times, such as during midterms or the night before an assignment is due. Get this taken care of now while you have time!

After downloading webstorm, you will need to decompress the package in which it came with a command like this:

tar xvfz ~/Downloads/WebStorm-X.X.X.tar.gz

For instance:

tar xvfz ~/Downloads/WebStorm-9.0.2.tar.gz

Then move the extracted files into the bin folder:

mv ~/Downloads/WebStorm-9.0.2.tar.gz ~/bin/webstorm

On Lubuntu, you should then place this file in the Desktop folder:

[Desktop Entry]
GenericName=WebStorm with JavaScript support
Comment[en_US]=Jetbrains JavaScript HTML

The process for install PyCharm is nearly identical, with only the obvious changes in name and path. I install PyCharm in:


Install Android SDK

Download the Android SDK for Linux.

Decompress the archive with a command similar to this:

tar xvfz android-sdk_r24.4.1-linux.tgz

Now create a home directory for Android:

mkdir ~/Android

Move the SDK into it:

mv android-sdk-linux/ ~/Android/Sdk

Assuming you have your path set up correctly in .bashrc, as explained above, then you simply type:


Because of space limitations, install as little as possible. In particular, you probably don't need the TV related modules, or probably the Atom modules.

Install MongoDb

We probably will not be installing MongoDb on our machines, but if you are curious, there is an explanation is found here:

Chrome Bin Setup

Don't do this on EC2, as you would not normally install Chrome on EC2 since there is no front end (GUI) for Ubuntu Server. But on Ubuntu and Lubuntu Desktop, it is needed in some circumstances related to development.

Under SystemCheck Common, this will fix CHROME_BIN errors.

Normally you would put this line near the bottom of ~/.bashrc.

export CHROME_BIN=/usr/bin/chromium-browser

After making the change run source ~/.bashrc.

NOTE: If you are trying to get SystemCheck to pass, then do your work in the same bash shell where you are running SystemCheck. In particular, exit the program, run the command, then run SystemCheck again.

Though the path rarely varies, to confirm the path to Chromium on your system, type which chromium-browser. Whether you specify the path to Chromium or Chrome is more or less optional. There is no wrong choice, it just depends on your preferences.

Default Editor

It may be helpful to setup a default editor:

sudo update-alternatives --config editor

Or try select-editor

$ select-editor

Select an editor.  To change later, run 'select-editor'.
  1. /bin/ed
  2. /bin/nano        <---- easiest
  3. /usr/bin/code
  4. /usr/bin/geany
  5. /usr/bin/vim.basic
  6. /usr/bin/vim.tiny

Choose 1-6 [2]:

Though it doesn't seem to be used much anymore, you could once pick an editor by creating an environment variable. So by running any of the following at a nix command prompt:

export EDITOR=nano
export EDITOR=vim
export VISUAL=nano