Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

« Newer Snippets
Older Snippets »
13 total  XML / RSS feed 

Ubuntu 7.10: bootstrap a Ruby on Rails stack

// get started with ubuntu 7.1
// e.g. on a new slice from http://slicehost.com !

# 1) make yrself a user and stop being root

# 2) main web stack + ruby
sudo aptitude install -y make screen
sudo aptitude install -y apache2 php5 mysql-server
sudo aptitude install -y subversion postfix
sudo aptitude install -y ruby1.8 ruby1.8-dev rubygems irb
sudo aptitude install -y imagemagick librmagick-ruby1.8 librmagick-ruby-doc libfreetype6-dev xml-core

# 3) gemz
# rubygems appears to be broken as hell. 
# gem update --system does squat
# had to manually d/l rubygems 1.0.1, ruby setup.rb
wget http://rubyforge.org/frs/download.php/29548/rubygems-1.0.1.tgz
tar xzvf rubygems-1.0.1.tgz
cd rubygems-1.0.1
sudo ruby setup.rb
sudo gem install rails mongrel merb map_by_method


Mounting CIFS shares on Ubuntu with utf8 support

Just a simple reminder how to use the WD MyBook WE with Linux properly.

sudo aptitude install smbfs
sudo mkdir /media/sharename
sudo vim /etc/nsswitch.conf

change
hosts: files dns

to read
hosts: files wins dns

sudo aptitude install winbind


I mount it manually with
sudo mount -t cifs //MyBookWorld/PUBLIC /media/shares/MyBook/PUBLIC -o username=
"vasil",password="MyPassword",iocharset=utf8,uid=vasil,guid=vasil,rw,noperm

launch firefox ubuntu

first to find the big hex number
then to add it. Note the format of the command

xauth list
xauth add ubuntu/unix:0 . 8443108aff2df3cff0d91fa307ad3885

ubuntu linux headers install

for various reasons (like installing vmware tools)

apt-cache search linux-headers-$(uname -r)
apt-get install linux-headers-$(uname -r)

ubuntu search apt-get packages

look up package names and contents via shell

apt-cache search <search string>

ubuntu apt-get list installed packages and removal

// description of your code here

will give you a nice list of installed packages...
apt-get install apt-show-versions

apt-show-versions | sort


best way to remove all traces of them is
apt-get --purge remove packagename

(I got fancy and did apt-get --purge remove php5* which removed all of em)

Ubuntu Setup

Added a 256slice w/ Ubuntu 6.06
passwd
rm /etc/localtime
ln -s /usr/share/zoneinfo/Canada/Atlantic /etc/localtime
vi /etc/apt/sources.list [add 4 universe repos]
apt-get update
apt-get upgrade
adduser kenzie
vi /etc/ssh/sshd_config [PermitRootLogin no, UseDNS no, AllowUsers kenzie]
/etc/init.d/ssh restart
sudo update-alternativesconfig editor [1]
visudo [kenzie ALL=(ALL) ALL]
reboot
apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server
mysqladmin -u root -p password yourpassword
apt-get postfix
apt-get install chkrootkit [and run it]
vi /etc/php5/apache2/php.ini [display_errors = Off, log_errors = On, error_log = /var/log/php-error.log]
apt-get install subversion php5-xsl


Shorewall firewall.
Munin and Monit monitoring.

How to set a static IP in Ubuntu from the shell

Edit /etc/network/interfaces and adjust it to your needs (in this example setup I will use the IP address 192.168.178.50 for eth0):

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# This is a list of hotpluggable network interfaces.
# They will be activated automatically by the hotplug subsystem.
mapping hotplug
        script grep
        map eth0

# The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.178.50
        netmask 255.255.255.0
        network 192.168.178.0
        broadcast 192.168.178.255
        gateway 192.168.178.1
        #optional
        #dns-nameserver 102.168.178.1


You can also edit /etc/resolv.conf to configure a dns-server to use:

nameserver 192.168.178.1

How to ssh into Ubuntu on Parallels by hostname

this is something that strangely doesn't happen automatically on ubuntu
in Ubuntu, just add
send host-name "dapperbox";

to your /etc/dhcp3/dhclient.conf file

you might need to do a
sudo /etc/services/networking restart


On your Mac, you can now do
ssh username@dapperbox


instead of

ssh username@1.2.3.4

Mount Strongspace to a folder in Ubuntu

1) Install the software
sudo apt-get install sshfs


2) Add fuse to /etc/modules
sudo nano /etc/modules


3) Add yourself to the 'fuse' group, then log out and log in again.
sudo adduser your-username fuse


4) Create a mountpoint and give yourself ownership
sudo mkdir /media/mount-name
sudo chown your-username /media/mount-name


5) Mount the filesystem
sshfs remote-system-name:/remote-folder /media/mount-name


6) Unmount the filesystem
fusermount -u /media/mount-name


Directions lifted from Ubuntu forums and here also.

For myself, I had better results running the following command in the same directory that the file that I mounted resides in...

sudo sshfs user_name@subdomain.strongspace.com: folder_name


Where folder_name is the name of the folder that you are mounting strongspace to.

How to set a static IP in Ubuntu from the shell

Edit
/etc/network/interfaces 
and adjust it to your needs (in this example setup I will use the IP address 192.168.0.100):

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# This is a list of hotpluggable network interfaces.
# They will be activated automatically by the hotplug subsystem.
mapping hotplug
        script grep
        map eth0

# The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.0.100
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1

How to Rip a DVD in Ubuntu Linux

First, install Handbrake:


sudo apt-get install nasm build-essential devscripts fakeroot
mkdir ~/tmp
cd tmp
wget http://apt.cerkinfo.be/pool/main/x264/x264_0.0.20050906-1.diff.gz
wget http://apt.cerkinfo.be/pool/main/x264/x264_0.0.20050906-1.dsc
wget http://apt.cerkinfo.be/pool/main/x264/x264_0.0.20050906.orig.tar.gz
dpkg-source -x x264_0.0.20050906-1.dsc
cd x264-0.0.20050906/
dpkg-buildpackage -rfakeroot
cd ..
sudo dpkg -i *.deb
sudo apt-get install debhelper libgtk2.0-dev jam nasm liba52-dev libavcodec-dev libdvdcss2-dev libdvdread3-dev libfaac-dev libmpeg2-4-dev liblame-dev libmp4v2-dev libogg-dev libsamplerate-dev libvorbis-dev libwxgtk2.6-dev libx264-dev libxvidcore-dev
wget http://handbrake.m0k.org/mirrors/m0k/HandBrake-0.6.2-src.tar.gz
tar -xzvf HandBrake-0.6.2-src.tar.gz
cd HandBrake-0.6.2
jam
sudo cp HBTest /usr/local/bin/handbrake

Next, follow the instructions from the Ubuntu Forums to compile and install MPlayer 2.0 from CVS.


Now we can actually rip the DVD:


cd ~/tmp
handbrake -e xvid -E ac3 -2 -S 1400 -i /dev/cdrom -o MOVIENAME.avi


Finally, split the DVD into two files:


mencoder -ovc copy -oac copy -endpos 700MB -o MOVIENAME.CD1.avi MOVIENAME.avi


The output will finish with something like:

Video stream: 1297.378 kbit/s  (162172 B/s)  size: 638610165 bytes  3937.851 secs  94414 frames

Note the number of seconds (in this case: 3937).


mencoder -ovc copy -oac copy -ss NUMER_OF_SECONDS -o MOVIENAME.CD2.avi MOVIENAME.avi


That's it!

Use Sun Java in Ubuntu Breezy

Download the binary installer from Sun.

Make sure the universe and multiverse repositories are enabled.

sudo apt-get install fakeroot java-package java-common

fakeroot make-jpkg --full-name "My Name" --email "[email protected]"

sudo dpkg -i sun-j2re1.5_1.5.0+update05_i386.deb

sudo update-alternatives --config java
« Newer Snippets
Older Snippets »
13 total  XML / RSS feed