Michael's Blog |
| Home | RSS | Gallery | Stats | About | Comics | Downloads | Links | Scripts | Test Scripts | Wiki | Xen Stats | |
If you're sick of the update notifier bugging you on your Ubuntu desktop you can easily set up a cron job to automatically take care of things.
sudo crontab -e 0 5 * * * apt-get -y upgrade
Change the time to whenever you want.
Directory '/var/run/screen' must have mode 777.
This is a fairly common error I've been seeing lately and the solution is quite simple.
chmod g+s /usr/bin/screen
If you're a bash user like me and login to A LOT of servers every day, it helps to have a visible notation of what server you're actually on. Add this to your .bashrc file and source it.
# set prompt PS1="[\u@`hostname`] \W > " PS2=">"
There's a lot more you can do like adding a clock, the history number, etc. but I prefer to keep it simple.
Virtualization is a big trend in computing right now and Solaris offers some very nice options of its own. One of these features is zones and branded zones which allow non-native operating systems to be installed into a container, this is similar to other technologies like OpenVZ and linux-vserver but zones add the power of ZFS as well.
I started reading the excellent article on Blastwave about setting up zones in Solaris 10 and within an hour I had everything finished with a Linux branded zone running CentOS 3.9. Here's a quick run down on how to accomplish this.
First create a file system to contain your zones:
zfs create -o mountpoint=/zone rpool/zone
After this is done you need to create the zone and install it, these are two separate processes.
zonecfg -z lx-zone lx-zone: No such zone configured Use 'create' to begin configuring a new zone. zonecfg:zone1> create zonecfg:zone1> set zonepath=/zone/1 zonecfg:zone1> set autoboot=true zonecfg:zone1> set brand=lx zonecfg:zone1> add net zonecfg:zone1:net> set address=192.168.35.210/24 zonecfg:zone1:net> set physical=hme1 zonecfg:zone1:net> end zonecfg:zone1> verify zonecfg:zone1> commit zonecfg:zone1> ^D
For the install you will need the iso images or a tar ball of a file system, you also need to create a new distro file as Solaris only goes up to CentOS 3.8 right now.
wget http://mirrors.liquidweb.com/CentOS/3.9/isos/i386/CentOS-3.9-i386-bin1of3.iso wget http://mirrors.liquidweb.com/CentOS/3.9/isos/i386/CentOS-3.9-i386-bin2of3.iso wget http://mirrors.liquidweb.com/CentOS/3.9/isos/i386/CentOS-3.9-i386-bin3of3.iso cd /usr/lib/brand/lx/distros/ cp centos38.distro centos39.distro
Edit this file and change the serial to "1183469235.99" and the version to "3.9"
Now install the OS
zoneadm -z lx-zone install -d /export/centos_3.9/ core
Check the results:
bash-2.05b# zoneadm list -vc ID NAME STATUS PATH 0 global running / - lx-zone installed /zone/1
The STATUS is now "installed".
Boot the environment:
bash-2.05b# zoneadm -z lx-zone boot bash-2.05b# zoneadm list -vc ID NAME STATUS PATH 0 global running / 2 lx-zone running /zone/1 bash-2.05b# ping 192.168.35.210 192.168.35.210 is alive
Now you can access the zone using zlogin:
# zlogin -C -e\@ lx-zone [Connected to zone 'lx-zone' console] CentOS release 3.9 (Final) Kernel 2.4.21 on an i686 lx-zone login: -bash-2.05b# uname -a Linux lx-zone 2.4.21 BrandZ fake linux i686 i686 i386 GNU/Linux
As you can see zones are very powerful and allow a system to be divided up as you see fit. Each zone is completely isolated from the others and has its own cpu limits, process lists, network stack, etc. Even if a zone is completely wiped out it will not affect your global zone.
Some how I got on the subject of the gopher protocol today and just for kicks I set up a gopher daemon on my server, you can access it at gopher://watters.ws. Firefox will work with this link along with any regular gopher client of course. I had to do some digging to find details on how to create the main gopher links page but it's actually pretty simple since everything is plain text, I understand the basics now so I can add anything that I want to the menu.
My music collection is also being run over a read only NFS mount here, feel free to browse around but I may take it down soon, the chances of the RIAA checking gopher sites is pretty slim but you never know.
Last night I set up ushare to stream videos from my PC to the Xbox, it's a lot more comfortable sitting on the couch to watch movies and now I can just download anything that I want to watch.
Setting things up wasn't too difficult, I had to add an extra NIC and run a crossover cable for the connection, I also had to set up IP masquerading which only requires 4 simple iptables rules. After that stuff is done just start up ushare and point it to your video directory, the Xbox will automatically see the share and let you browse videos.
If you don't have an Xbox ushare also works with the Playstation 3 or any other UPNP or DLNA device, there's also dedicated boxes that you can buy for your TV that just need a network connection.
Here's my Cpanel tip of the day.
If you want to restore backups for a server on the command line just run this.
cd / ln -s /backup/cpbackup/(daily,weekly,monthly) web cd web for x in ls *.tar.gz | cut -d "." -f 1; do /scripts/restorepkg $x; done cd .. rm web