Install Ubuntu 12.04 Server on 4GB USB stick
Few days ago i decided to update my server. I was running old Fedora 14 (Amahi) and update to Fedora 15 wasnt possible because of Amahi installation. Amahi recently switched over to Ubuntu and they abandoned support for Fedora 16. Well, even if update to F16 would be possible, i wouldnt update because Amahi isnt that useful in my opinion. Many apps are payable and you need to install them manually if you want to get them for free.
Therefore i decided to install Ubuntu 12.04 on 4GB USB stick. Why on USB stick? That is because i use my server for only three things: torrents (Transmission), OScam and CCcam. 4GB USB stick seemed like a great alternative to ordinary HDD (i was running F14 on 200GB HDD that came with the HP Microserver N36L). EDIT: I now suggest that you rather use 8GB or 16GB. Its better because 4GB can soon become abit tight and you will run out of space 🙂
You may be asking yourself now, how is it possible to install Ubuntu 12.04 Server on such small storage device. Well its possible without any problems. Just check this page: http://athlon1900.dyndns.tv/OsirisCS-Ubuntu12/Allgemeines/
Here you can find x86 version of Ubuntu 12.04. Sorry, no x64 version on this site. Size of .ISO file is only 27MB which is just crazy low number! A lot of packages are missing but you can download them manually so thats not a problem.
Here is install procedure:
1. STEP
Find 4GB or larger USB stick. 2GB is too small for Ubuntu installation!
2. STEP
Remove old HDD with Linux OS (if you have it) and use your chosen USB stick. You also need to change boot priority in BIOS. USB stick should boot first. I have HP Microserver that has USB port on motherboard and when it detect USB stick in this port, it automatically boots from this USB. Very neat feature!
3. STEP
Follow on screen instructions. Installation is not hard so i will not go into details here.
4. STEP
Ubuntu will boot into command line mode after installation. If you are not familiar with command line (terminal), then walk away from this tutorial! Now you need to create root password. Use these commands:
sudo passwd root
Ubuntu will then ask you for password. It should look something like this:
[sudo] password for ramesh: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
5. STEP
Now you need to set up auto login with user root. Use this command in terminal:
nano /etc/init/tty1.conf
Now you search for something like this:
exec /sbin/getty -8 38400 tty1 -a root
You see root at the end? In default installation there wont be root at the end of this line. You need to replace default value (i dont remember now what was there by default) with root! When you are done with editing, press CTRL-X and then confirm changes with button Y. Thats it. After reboot you wont have to enter username and password! You will be automatically login as user root. Nice!
6. STEP
Now i would recommend that you install WEBMIN which is very useful if you want to set up network shares or change some other settings. You need to do this:
sudo apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python
Then you run this command:
wget http://prdownloads.sourceforge.net/webadmin/webmin_1.590_all.deb
and the this one:
sudo dpkg -i webmin_1.590_all.deb
Thats easy right? Webmin will be then accessible through port 1000 = http://SERVERIP:10000/
7. STEP
Be sure to install OpenSSH package during Ubuntu installation. If you dont select this, you have to install it afterwards. Just use apt-get install openssh-server openssh-client
command! OpenSSH enables you to connect to your server using Putty and SSH connection!
8. STEP
If you want, you can also install Transmission. Use this command:
apt-get install transmission-daemon
This will only install daemon and not a client. You dont need this on headless server that we are trying to build or make 🙂 Now connect to your server using FTP (i suggest WINSCP) and search for transmission-daemon file in /etc/init.d/ folder. Open it with Notepad++ and search for this:
NAME=transmission-daemon DAEMON=/usr/bin/$NAME USER=debian-transmission STOP_TIMEOUT=30
Replace this with these lines:
NAME=transmission-daemon DAEMON=/usr/bin/$NAME USER=root STOP_TIMEOUT=30
Now we need to edit settings.json. I suggest you use these settings:
{ "alt-speed-down": 50, "alt-speed-enabled": false, "alt-speed-time-begin": 540, "alt-speed-time-day": 127, "alt-speed-time-enabled": false, "alt-speed-time-end": 1020, "alt-speed-up": 50, "bind-address-ipv4": "0.0.0.0", "bind-address-ipv6": "::", "blocklist-enabled": false, "blocklist-url": "http://www.example.com/blocklist", "cache-size-mb": 4, "dht-enabled": true, "download-dir": "/mnt/500GB/Torrents", "download-limit": 100, "download-limit-enabled": 0, "download-queue-enabled": true, "download-queue-size": 5, "encryption": 1, "idle-seeding-limit": 30, "idle-seeding-limit-enabled": false, "incomplete-dir": "/root/Downloads", "incomplete-dir-enabled": false, "lpd-enabled": false, "max-peers-global": 200, "message-level": 2, "peer-congestion-algorithm": "", "peer-limit-global": 240, "peer-limit-per-torrent": 60, "peer-port": 51413, "peer-port-random-high": 65535, "peer-port-random-low": 49152, "peer-port-random-on-start": false, "peer-socket-tos": "default", "pex-enabled": true, "port-forwarding-enabled": false, "preallocation": 1, "prefetch-enabled": 1, "queue-stalled-enabled": true, "queue-stalled-minutes": 30, "ratio-limit": 2, "ratio-limit-enabled": false, "rename-partial-files": true, "rpc-authentication-required": false, "rpc-bind-address": "0.0.0.0", "rpc-enabled": true, "rpc-password": "{9e73614bdbc1012766d2d4f864650f956281c5feGBTlCrfH", "rpc-port": 9091, "rpc-url": "/transmission/", "rpc-username": "", "rpc-whitelist": "127.0.0.1", "rpc-whitelist-enabled": false, "scrape-paused-torrents-enabled": true, "script-torrent-done-enabled": false, "script-torrent-done-filename": "", "seed-queue-enabled": false, "seed-queue-size": 10, "speed-limit-down": 100, "speed-limit-down-enabled": false, "speed-limit-up": 100, "speed-limit-up-enabled": false, "start-added-torrents": true, "trash-original-torrent-files": false, "umask": 0, "upload-limit": 100, "upload-limit-enabled": 0, "upload-slots-per-torrent": 14, "utp-enabled": true }
Line that is bold need to be changed, according to your setup. Also, umask needs to be set to value 0! Default value is 18 and its not good. Where is this settings.json file? You can find it in folder /etc/transmission-daemon
Before editing, you need to first stop transmission-daemon service, otherwise settings.json will revert to default state when you will reboot your server. Use this comman to stop this service:
service transmission-daemon stop
Then you can start with editing settings.json file. When you finish with editing, save this file and upload it back to the server using FTP of course. Use this command to start the service again:
service transmission-daemon start
Transmission will now start and settings should not be erased this time. Transmission can be access via http://YOURSERVERIP:9091/
I suggest that you install Transmission Remote GUI on your PC (if you have Windows OS). Its great piece of software and enables you to add or remove new torrents with ease.
8. STEP
Now you can install other stuff too, it depends what you want. If you want to use server for OScam and CCcam, please also check my other tutorials on this site. Installing CCcam is easy. Download CCcam 2.1.3 for x86 linux and put it in usr/local/bin folder. Then create /var/etc folder. You need to put CCcam.cfg file here. This is main configuration file for CCcam, very important!
If you want that CCcam starts automatically when you start your server, use Webmin! Just check image that you can find below if you want to see how to create cronjob in order to enable autostart of CCcam. You can do the same for OScam too 😉 OScam installation is a bit harder because you need to compile it. On this you can also find tutorial about compiling OScam on Ubuntu.
Also check this pictures:
This is the end of this quite long tutorial. If you have any questions, just leave a comment!