Archive for the ‘Distributions’ Category
The following tutorial describes the steps to optimize the performance of a MySQL database with the mysqltuner script.
Login to your server on the shell, then execute the following commands:
Download the mysqltuner script:
chmod +x mysqltuner.pl
Then enter root as username and the mysql root password.
You will get a output similar to this:
>> MySQLTuner 1.0.1 – Major Hayden <email@example.com>
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with ‘–help’ for additional options and output filtering
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password:
——– General Statistics ————————————————–
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.0.51a-24+lenny2
[!!] Switch to 64-bit OS – MySQL cannot currently use all of your RAM
——– Storage Engine Statistics ——————————————-
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 26M (Tables: 215)
[!!] InnoDB is enabled but isn’t being used
[!!] Total fragmented tables: 33
——– Performance Metrics ————————————————-
[--] Up for: 96d 23h 3m 41s (10M q [1.239 qps], 686K conn, TX: 701M, RX: 1B)
[--] Reads / Writes: 44% / 56%
[--] Total buffers: 58.0M global + 2.6M per thread (100 max threads)
[OK] Maximum possible memory usage: 320.5M (12% of installed RAM)
[OK] Slow queries: 0% (20/10M)
[OK] Highest usage of available connections: 33% (33/100)
[OK] Key buffer size / total MyISAM indexes: 16.0M/8.5M
[OK] Key buffer hit rate: 99.9% (57M cached / 30K reads)
[OK] Query cache efficiency: 78.6% (5M cached / 6M selects)
[!!] Query cache prunes per day: 483
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 408K sorts)
[!!] Temporary tables created on disk: 36% (269K on disk / 745K total)
[OK] Thread cache hit rate: 99% (427 created / 686K connections)
[!!] Table cache hit rate: 2% (64 open / 3K opened)
[OK] Open file limit used: 11% (120/1K)
[OK] Table locks acquired immediately: 99% (3M immediate / 3M locks)
——– Recommendations —————————————————–
Add skip-innodb to MySQL configuration to disable InnoDB
Run OPTIMIZE TABLE to defragment tables for better performance
Enable the slow query log to troubleshoot bad queries
When making adjustments, make tmp_table_size/max_heap_table_size equal
Reduce your SELECT DISTINCT queries without LIMIT clauses
Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
query_cache_size (> 16M)
tmp_table_size (> 32M)
max_heap_table_size (> 16M)
table_cache (> 64)
The script recommends to adjust or add the following variables in the mysql my.cnf file. The location of my.cnf is normally /etc/my.cnf or /etc/mysql/my.cnf depending on the Linux distribution that is installed on your server.
Open the my.cnf file:
and increase or set the variables in the [mysqld] section of the file. Mine looks now like this:
# * Basic Settings
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
# * Fine Tuning
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 128K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
#max_connections = 100
table_cache = 128
#thread_concurrency = 10
# * Query Cache Configuration
query_cache_limit = 1M
query_cache_size = 32M
tmp_table_sizee = 64M
max_heap_table_sizee = 32M
Then save the file and restart mysql. After a few hours, rerun mysqltuner and check again if the values are fine now or if the have to be increased to a higher value.
To create new SSL certificates for the dovecot pop3 and imap server on Ubuntu, follow these steps:
Make a backup copy of the old key and certificate file
sudo cp /etc/ssl/private/dovecot.key /etc/ssl/private/dovecot.key.old
sudo cp /etc/ssl/certs/dovecot.pem /etc/ssl/certs/dovecot.pem.old
Create the new key file
openssl genrsa -out /etc/ssl/private/dovecot.key 1024
Create the new certificate file, valid for 2 years
openssl req -new -x509 -key /etc/ssl/private/dovecot.key -out /etc/ssl/certs/dovecot.pem -days 730
Then restart dovecot
Sometimes you need to know to which debian or ubuntu package a specific file belongs, e.g. because you deleted a system file and want to reinstall it. There is a handy utility called apt-file which searches for a filename in all debian packages.
apt-get install apt-file
search for the file /etc/sysctl.conf
apt-file search /etc/sysctl.conf
apt-file search /etc/sysctl.conf
Now we see that the file is part of the debian / ubuntu package with the name “procps”.
The easiest way to make screenshots is to use Take Screenshot. You find it under Applications/Accessoires.
First change the delaytime for the screenshot from 0 to 1 or 2 seconds. This is the time you have to mark the chosen area. You should be fine with 1 second!
Then choose your screenshot option, e.g. Grab the current window. Klick on Take Screenshot and activate the window you need.
Take Screenshot closes. If all works well, a pop-up comes up to ask where to save the screenshot, which comes a s a .png.
For another screenshot you have to open the application again, so put it best in your panel.
The uncommon thing is that you have to run first Take screenshot and then choose an object, and not the other way round. That’s it!
KRITA is a free image editing tool that ist pretty versatile and helps you not only to edit images, but also to use it for more artistic work on e.g. tablet PCs. It will surely remind you of Photoshop.
The easiest way to install KRITA is to download it over the Ubuntu Software Center. Do not take the complicated way to install it manually…
First go to Applications/Ubuntu Software Center:
Type in the searchfield KRITA and press Enter to mark KRITA for installation.
As KRITA appears, double click it, and then just klick on the Install button, start the installation and wait some seconds.
Now KRITA should appear checked as it has beeninstalled. That’s it!
If you always wanted the Exposé effect on your Ubuntu Desktop, here you go! Active corners, known from Mac as Exposé, allow you e.g. to see all your open windows at once just by one mouse move into the corner of the desktop. Very useful if you are a multi-tasking god or goddess!
First open you terminal and copy & paste:
sudo apt-key adv –recv-keys –keyserver keyserver.ubuntu.com FE85409EEAB40ECCB65740816AF0E1940624A220
Log in with your admin password and continue:
sudo gedit /etc/apt/sources.list
Then add the following lines at the end of the file:
deb http://ppa.launchpad.net/tualatrix/ppa/ubuntu karmic main
deb-src http://ppa.launchpad.net/tualatrix/ppa/ubuntu karmic main
The source of Ubuntu tweak will be added to your repository. Updates for Ubuntu-Tweak will be installed automatically in future. Install Ubuntu-Tweak:
sudo apt-get update
sudo apt-get install ubuntu-tweak
Now you can enable a function for every corner, as you like. That’s it.
The winmail.dat file is a container file format used by Microsoft Outlook to send attachments in richtext formatted emails. To open winmail.dat on Linux, use the tnef utility.
sudo apt-get install tnef
Open a shell window, navigate to the directory where the winmail.dat file is saved, then execute the command:
to extract all files that are stored in the winmail.dat into the current directory.
More and more internet access providers are closing port 25 to reduce spam except for connections to their own mailservers. If you run your own mailserver and have problems to connect to it on port 25, you can enable port 465 (smtps) in postfix as a workaround. Edit the /etc/postfix/master.cf file:
and remove the # in front of the smtps line. Example for Debain 5, change the line:
#smtps inet n - - - - smtpd
smtps inet n - - - - smtpd
and restart postfix:
If a linux system user is able to login on the shell or with SSH depends on its shell setting in /etc/passwd. If you want to prevent that a certain user is able to login, then set the shell either to /bin/false or /sbin/nologin.
Example for Debian and Ubuntu Linux for the user with the username “otheruser”:
usermod -s /bin/false otheruser
For Redhat, Fedora or CentOS use /sbin/nologin:
usermod -s /sbin/nologin otheruser
Warning: Do not set the shell for the root user to /bin/false or /sbin/nologin!
The cronjobs (crontabs) for all system users in Debian and Ubuntu Linux are stored in the directory /var/spool/cron/crontabs. To make a backup with tar, use this command:
tar pcfz /root/user_crontabs.tar.gz /var/spool/cron/crontabs
The backup file user_crontabs.tar.gz is be stored in the /root/ folder.