This post will explain how to create your own Raspbian based operating system for the Raspberry Pi. You will need a Pi, a 4 GB SD card (you can try smaller if you keep programs installed to a minimum), a host pc for initial installation and the raspbian-ua-netinst image available on github here.
Download the img.xz file here, now extract the file using a program such as Ark and then flash the .img file to the SD card using the dd command like so :
$ sudo dd bs=1M if=/PATH/TO/FILE of=/dev/sdX && sync
So my command looked like this :
$ sudo dd bs=1M if=/home/mic/Downloads/raspbian-ua-netinst-v1.0.2.img of=/dev/sdc && sync
Once this is done we will need to eject/insert the SD card safely back into the PC so we can create a configuration file before we insert the SD card into the Pi. Create a file called installer-config.txt on the partition which mounts when you insert the SD card into the PC and input this information :
In this file are various options which can be changed, they are all fairly self explanatory. We will only be editing a few, the line which reads “packages= # comma separated list of extra packages” is used to add any additional programs you want installed, in this guide we will install the Openbox window manager to try keep things small, enter this list of packages seperated using a comma :
- raspi-copies-and-fills (for better memory management)
The next config option to change will be “hostname=pi” change pi to whatever hostname you would like, now an important option to change is “rootpw=raspbian”, change this to whatever you like making sure it is strong/memorable.
With these options changed, save and exit the installer-config.txt document then safely remove the card from the PC. Insert it into the Pi and let it boot up, it will start installing the base raspbian system to the card plus any extra packages you chose in the installer-config.txt file. When it is finished it will reboot.
Login to the pi with the username “root” and whatever password you chose in your config file. Open a terminal by right-clicking the desktop and selecting it from the menu. Now we need to create a regular user and add them to the sudo group with these commands :
$ adduser pi
$ adduser pi sudo
Now logout and back in to the pi with the new user details. After this we will install “raspi-config” which is a program used to help configure your raspbian os.
Before installing the downloaded raspi-config.deb the following dependencies have to be installed:
$ sudo apt-get install dmsetup libdevmapper1.02.1 libparted0debian1 parted lua5.1 triggerhappy -y
Next we download the .deb :
Then we install it with this command :
$ dpkg -i raspi-config_20130525-1_all.deb
To run “raspi-config” type this into a terminal :
$ sudo raspi-config
Make any alterations here as you see fit, such as the locale/timezone/keyboard settings/booting options/etc.
Now we need to configure our desktop so it is a little more user-friendly, to do this we will edit the tint2 panel config, set a wallpaper, create a conkyrc file, make it so you can logout/reboot easily, set-up archey and finally create/edit the autostart script for openbox.
To edit the tint2 panel type this into a terminal :
$ mkdir ~/.config/tint2
$ leafpad ~/.config/tint2/tint2rc
And paste in this information :
To set a wallpaper we use a program called nitrogen :
Select “preferences” and add the directory where your wallpapers live. Double click the image you’d like and click apply. Your auto-start script will restore this each time you log in.
Now we create a conkyrc file :
$ sudo leafpad ~/.conkyrc
And paste in this information :
Save and close the file.
If you don’t want to have to give your sudo password every time you shut down or restart, you can edit the sudoers file (in /etc/sudoers) to allow anyone to shut down or reboot the computer without administrative privileges. The sudoers file specifies who has administrative privileges on your computer and what user can do what. You’ll edit the file so that any user can use the ‘shutdown’ command without the need to give your sudo password. To do so, open a terminal and type
$ sudo EDITOR=nano visudo
Add the following at the bottom of the page:
Save and exit, and you won’t be needing your password to reboot or shut down. You can then add the following to your menu.xml file, wherever you want them to be in your menu. If you want to use Obmenu, add what is specified in the “Label” part in the “Label” box and what comes after “execute” in the “Execute” box.
sudo ‘shutdown -r now’
<item label=”Shut down”>
sudo ‘shutdown -h now’
You will no longer be asked to give your password to shut down or reboot now, or be a user with administrative privileges. (Note, though, that you’ll still need to preface the command with sudo!) The downside is that you also will no longer receive any warning before your computer shuts down.
To install archey :
$ sudo apt-get install lsb-release scrot
$ sudo dpkg -i archey-0.2.8.deb
Then add “archey” to the end of the bashrc file :
$ sudo leafpad /home/pi/.bashrc
Save and exit the file. The next step will create an autostart file and make sure all of these settings/programs start-up at boot :
$ mkdir ~/.config/openbox
$ leafpad ~/.config/openbox/autostart
And paste in this info :
Save and exit the file, when this is done you should have something similar to the OS i created using this method, Open-Pi, which is available from here. For a first attempt it isn’t to bad but could do with some improvement, if you like it then let me know in the comments below.