Skip to content

ubuntu linux

mount and umount a iso file

# create the directory where the iso file will be mounted
sudo mkdir /media/iso
# mount the file
sudo mount -o loop YOUR_FILE.ISO /media/iso
# umount the file
sudo umount /media/iso

replace servers on sources.list

sudo sed -i 's/us.archive.ubuntu.com/br.archive.ubuntu.com/g' /etc/apt/sources.list

a brief explanation:

reference: http://askubuntu.com/a/20416

identify a new network card

in my case, an Realtek RTL8029AS from parallels desktop.

lsmod |grep ne
modprobe -v ne
modprobe -v ne2k-pci

the drive was not listed. so, i need to check if the network card was found.

lspci -v | grep -A12 "Ethernet"

the nic was here, but no ip was set up. so, i removed the contents of 70-persistent-net.rules file, and restarted the server.

echo "" > /etc/udev/rules.d/70-persistent-net.rules
shutdown -r now

fix setting locale failed error

locale-gen pt_BR.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales

creating a swap file

# create a 4Gb swap file
sudo fallocate -l 4G /swapfile

# set permissions
sudo chmod 600 /swapfile

# format the file
sudo mkswap /swapfile

# enable swap on this file
sudo swapon /swapfile

# set some options on ubuntu, to better swap use
sudo sysctl vm.swappiness=10
sudo sysctl vm.vfs_cache_pressure=50

to made this changes permanent, add this to /etc/fstab

/etc/fstab
/swapfile   none    swap    sw    0   0

and add this to /etc/sysctl.conf

/etc/sysctl.conf
vm.swappiness = 10
vm.vfs_cache_pressure = 50

removing the canonical landscape service

sudo apt-get remove --purge landscape-client landscape-client-ui landscape-client-ui-install landscape-common

install vmware tools

sudo apt-get install --no-install-recommends open-vm-dkms
sudo apt-get install open-vm-tools

redefining the apt-cacher's cache

# stop the service
sudo /etc/init.d/apt-cacher-ng stop

# move the old cache to a new place. This way, we can remove it
# in background (depending on the size, deletion may take a while)
sudo mv /var/cache/apt-cacher-ng /var/cache/apt-cacher-ng.old
sudo rm -rf /var/cache/apt-cacher-ng.old &

# create the new cache hierarchy, and set the correct owner
sudo mkdir -p /var/cache/apt-cacher-ng/{headers,import,packages,private,temp}
sudo chown -R apt-cacher-ng:apt-cacher-ng /var/cache/apt-cacher-ng

# start the service again
sudo /etc/init.d/apt-cacher-ng start