Tips
From Maties Ubuntu
Contents |
Requirements
Try the following tips after you have setup software access and are familiar with using a terminal to install software. Read the "man" pages for the programs mentioned below. These tips need a working internet connection of course.
Desktop
Create a print to PDF system
- Install the cups-pdf software.
- Make a home folder called: PDF
Server
Default settings
Check configs in the /etc/default folder.
Setup your own local SQUID proxy
This saves a lot of internet bandwidth if you use an ADSL home connection.
MySQL Repair
To repair MySQL tables after a server or hardware crash try these commands;
mysqlcheck --all-databases --auto-repair --check -p
As user root with MySQL running
For the following you need to shutdown the MySQL server and specify the specific table location.
myisamchk \ --silent \ --force \ --fast \ --update-state \ -variable=key_buffer=64M \ -variable=sort_buffer=64M \ -variable=read_buffer=1M \ -variable=write_buffer=1M \ /var/lib/mysql/*/*.MYI
MySQL Backup and Restore
Login in as the root user first.
backup: # mysqldump -u dbusername -p[dbpassword] [dbname] > dumpfilename.sql
restore:# mysql -u dbusername -p[dbpassword] [dbname] < dumpfilename.sql
MySQL "root" Password Reset
To recover from a forgotten MySQL root password, you have to stop the MySQL server:
# service mysqld stop
In order to modify the root password, the MySQL server has to be started in safe mode:
# mysqld_safe --skip-grant-tables --skip-networking &
For the moment, MySQL is running without password protection, so this is the easy part. Login to the MySQL server using the command:
# mysql -u root
mysql> use mysql;
mysql> UPDATE user SET Password=PASSWORD("your-new-password-here") WHERE User="root";
Exit the MySQL CLI and restart the daemon:
mysql> exit; # service mysqld restart
Done.
PostgreSQL Backup and Restore
Login in as the postgres user first.
backup: # pg_dumpall | gzip -c > dumpfilename.sql.gz
restore:# gunzip -c dumpfilename.sql.gz && psql -f dumpfilename.sql
OpenLDAP Backup and Restore
Login in as the root user first and shutdown the OpenLDAP service then use the following.
backup: # slapcat -v -l ldapbackup.ldif
restore:# slapadd -v -c -l ldapbackup.ldif
Hardware
Disk Usage
Partition management
- Boot the Ubuntu Live CD and use gparted to resize/move partitions.
- To start gparted type ALT+F2 and then type gparted then press "Enter".
See: http://wiki.partedmagic.com/index.php/Using_GParted for detailed gparted information.
Install the latest kernel
See: http://kernel.ubuntu.com/~kernel-ppa/mainline/
Download the .deb file for your architecture and double-click on the downloaded file to install it.
Run a headless server with VNC login
Backup /etc/X11/xorg.conf and replace with the following:
Section "InputDevice" Identifier "Dummy Input" Driver "void" EndSection Section "Device" Identifier "Dummy Video" Driver "dummy" EndSection Section "Monitor" Identifier "Configured Monitor" EndSection Section "Screen" Identifier "Default Screen" Monitor "Configured Monitor" Device "Dummy Video" EndSection Section "ServerLayout" Identifier "DefaultLayout" Screen "Default Screen" InputDevice "Dummy Input" EndSection
Now setup a user to auto-login with GDM and then setup vinagre to allow remote logins with a password.
Device identification
Most devices are connected to the USB or PCI systems on a computer. To update the hardware database, typing the following in a terminal.
sudo update-usbids
See: http://www.linux-usb.org/usb.ids
sudo update-pciids
Faster file system access
Add the following to the regularly mounted items in your /etc/fstab file as root user;
noatime,nodiratime
Remember to back up your /etc/fstab in case of a boo-boo.
Apple MacBook
Keyboard "compose" keys for special characters
Type the following in a terminal:
sudo dpkg-reconfigure console-setup
Restore GRUB bootloader
Sometimes after re-installing Windows software you lose the grub bootloader. To restore GRUB apply the following.
- Boot with a live CD/DVD/USB
- Type the following commands in a terminal.
Start the "grub" software as the "root" user.
sudo grub
Check where the grub files are.
find /boot/grub/stage1
Check what is reported as the root partition, then type:
root (hdX,X)
Replace the X's with the correct numbers.
To restore, type:
setup (hd0)
That's it and reboot the target system.
Software
http://www.tecmint.com/convert-from-rpm-to-deb-and-deb-to-rpm-package-using-alien
How to remove Mono
You can remove Mono and all applications using the following commands:
sudo apt-get remove --purge mono-common libmono0
sudo apt-get --purge autoremove
Next, download and install Mononono, which sets up a conflict with the real Mono packages, stopping applications from pulling it back in. Like so:
wget http://tim.thechases.com/mononono/mononono_1.0_all.deb
dpkg -i mononono_1.0_all.deb
Old unsupported software archives
Old releases of Ubuntu software are available from the following web site:
http://old-releases.ubuntu.com
Setup your "java" software environment
To view options type the following in a terminal:
sudo update-java-alternatives -l
To see which java version provides alternatives type the following in a terminal:
sudo update-java-alternatives -s {java-version}
To check what java programs are available to install run the following in a terminal
sudo apt-cache search java | grep sun
To install a particular java version type the following in a terminal:
sudo apt-get install {java-version}
To setup for a particular version type the following in a terminal:
sudo update-java-alternatives {java-version}
galternatives
You can also use "galternatives" to setup Java.
sudo apt-get install galternatives
After it is installed, you can run it using:
gksudo galternatives
Faster software execution
To enable faster software start-up times install the following using a terminal;
sudo apt-get install preload
sudo apt-get install prelink
During upgrades and installs remember to check prelinking otherwise strange stuff happens.
Network
More robust name lookup service
To get a super healthy network system going, try installing the following programs using a terminal;
sudo apt-get install totd
sudo apt-get install nscd
