Over the years I have made several attempts to use Linux on my computers. Every time I have either failed miserably, or just got tired of it not working well enough. Since the release of the pitifully bad Windows 8, I have made more of an effort to actually get it running, but I didn't really get it going until this summer (2014). I bought a new laptop, a Lenovo Yoga 2 11, to take with me to Thailand, and after a lot of initial problems, I have been running Ubuntu 14.04 on it since then. Installing Ubuntu together with the old Windows 7 installation on my stationary PC was even harder to set up, but now I have finally got it to work.
- Ubuntu/Installing a LAMP stack
- Ubuntu/Install and set up an FTP server
- Ubuntu/Setting up bash completion
- Ubuntu/Install and set up VICE
- Ubuntu/Install and set up Transmission BitTorrent client
- 1 Mixed small stuff to install
- 2 Setting up Git
- 3 Installing Oracle Java
- 4 Installing Java for Google Chrome
- 5 Install the NFS client software
- 6 Mounting the transfer directory
- 7 Mounting the remote CDROM
- 8 Mounting the WD My Cloud NAS file server
- 9 Mounting extra hard drives automatically at start-up
- 10 Installing the Adobe Source Code Pro font
- 11 Where to put stuff
Mixed small stuff to install
# Source code management (SCM) systems sudo apt-get install subversion sudo apt-get install git # Source code and text file editing sudo apt-get install geany # For documenting source code sudo apt-get install doxygen doxygen-doc doxygen-gui # Command line tools sudo apt-get install tree # Show file structure and count files/directories # Needed if you want to make PDF files from the LaTeX files generated by doxygen. texlive-full # is not strictly speaking necessary, but if you have the disk space (about 3 GB), it is worth # installing it just to avoid having to try to determine which sub modules that you really # need. sudo apt-get install texlive-latex-base sudo apt-get install texlive-full
Note: I used to have nedit (Nirvana Edit) in this list, but I removed it 2014-09-13 since it doesn't really work that well on Ubuntu 14.04. Seems like they stopped working on it a couple of years ago.
Setting up Git
Installing Oracle Java
To install Oracles Java 7, run these commands from a terminal:
sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java7-installer
After the installation, you can test it by running this command:
Installing Java for Google Chrome
The Google Chrome web browser (as well as Chromium) needs a plugin to be able to handle Java on web sites. Unfortunately, since version 35 of Chrome, it no longer supports NPAPI plugins like Java (neither Oracle nor OpenJDK). The bug reports have been marked as "won't fix" and Oracle removes hateful discussions, so it seems like Chrome will never again support Java (on Linux).
Use Firefox for Java web pages.
Install the NFS client software
Don't remember how I did this...
Mounting the transfer directory
On the server, I have created an NFS-exported directory for quick-and-dirty file transfer between the computers on the network. This is how you mount it on the client.
Create the mount point directory (I chose to use /mnt/transfer):
sudo mkdir /mnt/transfer
Open the fstab file (which is where you define mounts that are to be made automatically each time computer boots) for editing:
sudo nano -Bw /etc/fstab
Add the following line in the file (change the mount point directory /mnt/transfer if you called it something else above):
mother:/transfer /mnt/transfer nfs4 rw,_netdev,auto 0 0
Run this command to mount the the stuff specified in the fstab file:
sudo mount -a
Mounting the remote CDROM
The server is the only computer on my network that has a CDROM, and it has been set up to share it over the network using an NBD (Network Block Device) server (see Sharing the CDROM using NBD).
To use a device shared from an NBD server, we first need to install the NBD client package:
sudo apt-get install nbd-client
During the installation, you will be asked what to do when the NBD client is asked to stop. Answer "Yes" to the question "Disconnect all NBD devices on stop?" (unless you know what you are doing and are not satisfied with that).
Now that the client is installed, we can tell it to use the CDROM exported by the server (mother is the host name of my home network server that is now exporting the CDROM, "-name cdrom" means that we want to access the export named cdrom, and /dev/nbd0 is the local NBD device file that we want to use for doing this):
sudo nbd-client mother -name cdrom /dev/nbd0
If that fails, or if you are unsure of what the export is called, you can list the devices that are being exported from mother with this command:
sudo nbd-client -l mother
Hopefully, you didn't get any error messages, and then you can test that the NBD device is mounted:
sudo nbd-client mother -check /dev/nbd0
The response you want to see from that command is a single number, which will be the PID (Process ID) of the process that connected the device. If you don't get any response at all, run this command directly after the one above:
The value should be "0" if all want well, and otherwise "1" (meaning that the device you queried about is not connected or does not exist) or "2" (meaning that an error occurred). If you believe that you performed the steps above correctly and it still didn't work, go to the server and use the dmsg command to check the syslog for error messages.
So, now you have a local CDROM (sort of) with the device name /dev/nbd0. In the same way as if it was a real local CDROM, you must now mount it in order to read the contents of the inserted disk (creating the mount point directory /mnt/cdrom if it doesn't already exist):
sudo mkdir /mnt/cdrom # Only if it doesn't already exist sudo mount -r /dev/nbd0 /mnt/cdrom
That's it. Now you can, for example, list the contents of the disk in the CDROM with:
ls -l /mnt/cdrom
Don't forget to dismount the CDROM when you're done with it:
sudo umount /mnt/cdrom
And you should also disconnect the remote CDROM device:
sudo nbd-client -disconnect /dev/nbd0
Mounting the WD My Cloud NAS file server
I have a Western Digital My Cloud 2 TB NAS file server in my home network. That is where I (among other things) store all my films and music, so I want it to be easily accessible from Ubuntu. I do this by mounting it as an NFS device.
First we need a static handle for the NFS export in the NAS. I have given it a static IP address in the router, but we will refer to it by host name (WDMyCloud) anyway. So the handle will be WDMyCloud:/nfs.
Then we must create an empty local directory as the mount point (I chose /mnt/wdmycloud), and add a line describing the mount in the /etc/fstab file:
sudo mkdir /mnt/wdmycloud sudo nedit /etc/fstab
To set up the mount exactly as described above, just copy this line to the fstab file and save it:
WDMyCloud:/nfs /mnt/wdmycloud nfs rw,udp,vers=3,soft,intr,rsize=8192,wsize=8192 0 0
The NAS will now be mounted as /mnt/wdmycloud automatically at start-up. To mount it manually right now (and thereby testing the new entry in the fstab file, enter the following command:
sudo mount -a
Mounting extra hard drives automatically at start-up
After installing Ubuntu 14.04, you will notice that Nautilus (the file browser) already have items for all of your hard drives in the Devices sub menu. To use them, you just click the device label or icon - no surprise there.
If you right-click the label of one of the drives other than the "system drive", you will see that the context menu contains a Mount option, which indicates that the drives (except for the system drive where Ubuntu is installed) are not automatically mounted at start-up.
Normally, this is not a problem, since Nautilus will mount it for you when you attempt to access it. However, other applications may have a problem with this.
For example, I set up the Transmission bit-torrent client to temporarily store the torrents on my large DATA drive while downloading, and then move the completed file to my WDMyCloud NAS. It took me quite some time to realize that the reason for why the torrent downloads failed most of the time was that it failed to write to the DATA drive when it wasn't mounted. "How could you not see that right away, moron!?" you probably wonder. Well, Transmission didn't actually say that it was the DATA drive that was the problem - instead it claimed that it couldn't write to the NFS-mounted WDMyCloud NAS, which of course was a straight up lie.
On a side-note, I have reported this incorrect error message to the TransmissionBT development team.
A simple workaround was to run Nautilus and just open the DATA drive (so that Nautilus mounted it), and then everything worked just fine. The only real problem with that was that I never remembered to do it before I had already added a bunch of torrents that crashed, so that I had to remove them all and add them again after mounting the DATA drive.
A better solution is of course to add an entry to /etc/fstab so that the DATA drive (in this case) is mounted automatically at start-up.
Editing /etc/fstab by hand is non-trivial, but there is a GUI that makes it relatively easy.
- Click the Windows button to open the Search window, and type "disks".
- Select the Disks application.
- In the Disks window, select the device that you want to auto-mount under Devices.
- In the right-hand side of the window, just below the graphical presentation of the volumes on the device, click the cog-wheel icon ("More actions") and select Edit Mount Options... from the drop-down menu.
- In the Mount Options dialog:
- Set Automatic Mount Options to "OFF".
- Make sure that Mount at startup is checked.
- Click the OK button.
- You will now be asked to provide the root password so that the changes can be written to /etc/fstab, Do this and you are done.
Installing the Adobe Source Code Pro font
Source Code Pro from Adobe is a free, mono-spaced font that is specifically designed for editing source code. I install it on all my computers.
Open a terminal window and run the commands below. This will install the fonts for system wide usage. If you, for some reason (such as if this is not your own computer so you don't have root privileges), want to install them for just your own user, just copy the font files to ~/.fonts directory (create it if you don't have one) instead of /usr/local/share/fonts/. And (obviously) you don't need to use sudo to copy the files in that case.
cd ~/Downloads wget http://downloads.sourceforge.net/project/sourcecodepro.adobe/SourceCodePro_FontsOnly-1.017.zip unzip SourceCodePro_FontsOnly-1.017.zip sudo cp SourceCodePro_FontsOnly-1.017/OTF/*.otf /usr/local/share/fonts/ fc-cache -f -v
Where to put stuff
It is often far from obvious where you should place stuff (such as your own scripts) in a Unix/Linux file system. If you write a script that is for your personal use, then it makes sense to put it in ~/bin. But where should you put it if it is intended for other users, too? There are lot of existing options: /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin, etc.
I recently learned about man hier, which gives a rather extensive description of the file system hierarchy. It is actually well worth reading, and since it is readily available, I'll just mention the bin directories briefly here (the descriptions below are mostly just copied from the hier man-page.
- ~/bin: This is where you place your personal-use executables.
- /bin: Contains executable programs which are needed in single user mode to bring the system up or repair it.
- /usr/bin: /usr is (at least on larger systems) typically mounted from a separate partition. It should hold only sharable, read-only data, so that it can be mounted by various machines running Linux. /usr/bin is is thereby the primary directory for executable programs; Most programs executed by normal users, which are not needed for booting or for repairing the system and which are not installed locally should be placed in this directory.
- /usr/local/bin: Binaries for programs local to the site.
The sbin directory structure is very similar, but the sbin sirectories should only contain executables that are typically used by the system and not by its users.
So, for executables: If it is for personal use, put it in ~/bin. If it is for general use, put it in /usr/bin. At least that's how I will do it.