If you update your Ubuntu kernel frequently, eventually you will come to the realization that it is taking a lot of space to keep the old versions around on disk. Another annoyance is that your Grub loader will show a very long list. Sure, you can keep them around forever, should you need to recover them, but for most people it’s safe to remove them. You can manually select and remove the packages in Synaptic, but the easiest way I’ve found is to sun the following script instead. It will remove all old kernel version (except the current one!):
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
Occasionally, you might also want to follow that with the following to clean up other artifacts too…
sudo apt-get autoremove
With the rate of updates and security patches for Java, administration of your Ubuntu machines can become tedious. There’s a better way… allow it to check for and update with your other software. The steps are easy…
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
NOTE: You can also install java8 in the same manner with:
sudo apt-get install oracle-java8-installer
NOTE: The Java Control Panel can sometimes be hard to locate, it will be at the following:
Installing MySQL on Ubuntu requires only a few simple steps.
sudo apt-get install mysql-server
sudo netstat -tap | grep mysql
sudo vi /etc/mysql/my.cnf
sudo service mysql restart
To look for some simple performance and security suggestions:
sudo apt-get install mysqltuner
Adding a new user is equally easy…
mysql --user=root --password=mypassword mysql
CREATE USER 'myusername'@'%' IDENTIFIED BY 'mypassword';
GRANT ALL PRIVILEGES ON *.* TO 'mydatabase'@'%' WITH GRANT OPTION;
NOTE: This allows access to the user from ALL hosts, it can be limited by replacing the
'%' with a specific hostname (such as ‘localhost’ if desired) for security.
Logging is often an overlooked performance drain on systems requiring high throughput. Here’s a simple change to the default Tomcat logging configuration to implement. It works on all operating systems.
In the file:
.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
.handlers = 1catalina.org.apache.juli.FileHandler
There are a few steps that I generally take to setup a new Tomcat server instance, this enables the following:
- The manager console
- HTTP compression
- UTF-8 encoding
- tomcat-users.xml – add to bottom:
<user username="tomcat" password="s3cr3t" roles="manager-gui"/>
server.xml – add compression and URIEncoding, change port if desired:
<Connector port="8080" protocol="HTTP/1.1"
redirectPort="8443" compression="on" URIEncoding="UTF-8" />
- server.xml – relocate webapps by adding ../ to appBase
<Host name="localhost" appBase="../webapps"
- Restart your server, on Ubuntu use:
sudo service tomcat7 restart
Ubuntu continues to make great strides with improvement to the User Interface for the ‘common’ user. Unfortunately this sometimes comes at the cost of security. 12.10 added a “Guest” account to the launch screen, to allow a new session to be opened. This is not always useful as it represents a potential security concern.
A single line command and reboot will remove it:
sudo sh -c 'echo "allow-guest=false" >> /etc/lightdm/lightdm.conf'
Similarly “Remote Login” can also be hidden/removed.
sudo sh -c 'echo "greeter-show-remote-login=false" >> /etc/lightdm/lightdm.conf'
WARNING: This will cause some problems in 15.10 (and likely some earlier versions before). See the following for the new method.
sudo sh -c 'printf "[SeatDefaults]\nallow-guest=false\n" >/usr/share/lightdm/lightdm.conf.d/50-no-guest.conf'
I’ve done a lot of Internationalization(I18N) and Localization (L10N) work in my various development positions. One particularly troubling area is currency support. Support of number formats is generally well supported (or can be accomplished with some trivial input translation). However, the tricky area come with support for currency symbols, western currencies such as USD (US$) and CAD(C$) and the Euro (EUR or €) are well supported across character sets and fonts some are not. One particular item is for the Indian Rupee (INR). Ubuntu 10.10 is the first operating system to ship with a font that supports this character ₹
With the rapid release cycle (currently every 6 weeks) for Firefox, it’s a good idea for developers and testers to use the upcoming release versions before they are released to the general public.
For Windows users, you can download and install an appropriate version from:
On Ubuntu, it’s a little more difficult, but rater straight-forward:
- Open a new Terminal window
sudo add-apt-repository ppa:mozillateam/firefox-next
sudo apt-get update
sudo apt-get install firefox
That’s all…. Happy Testing!
Assuming that you are a developer on Windows that run a VirtualBox instance for a server, you might find it difficult to browse/access the “virtual” server that are running as a client. Here’s an example of the config required for standard HTTP, HTTPS and SSH, you can easily expand for other services as needed. Example assumes that your client is named “Ubuntu64”, you need to change appropriately for each client.
NOTE: if you are using a Linux host, the commands are similar.
cd C:\Program Files\Oracle\VirtualBox
VBoxManage.exe setextradata "Ubuntu64" VBoxInternal/Devices/pcnet/0/LUN#0/Config/ApacheHTTP/HostPort 80
VBoxManage.exe setextradata "Ubuntu64" VBoxInternal/Devices/pcnet/0/LUN#0/Config/ApacheHTTP/GuestPort 80
VBoxManage.exe setextradata "Ubuntu64" VBoxInternal/Devices/pcnet/0/LUN#0/Config/ApacheHTTP/Protocol TCP
VBoxManage.exe setextradata "Ubuntu64" VBoxInternal/Devices/pcnet/0/LUN#0/Config/ApacheHTTPS/HostPort 443
VBoxManage.exe setextradata "Ubuntu64" VBoxInternal/Devices/pcnet/0/LUN#0/Config/ApacheHTTPS/GuestPort 443
VBoxManage.exe setextradata "Ubuntu64" VBoxInternal/Devices/pcnet/0/LUN#0/Config/ApacheHTTPS/Protocol TCP
VBoxManage.exe setextradata "Ubuntu64" VBoxInternal/Devices/pcnet/0/LUN#0/Config/Tomcat/HostPort 8080
VBoxManage.exe setextradata "Ubuntu64" VBoxInternal/Devices/pcnet/0/LUN#0/Config/Tomcat/GuestPort 8080
VBoxManage.exe setextradata "Ubuntu64" VBoxInternal/Devices/pcnet/0/LUN#0/Config/Tomcat/Protocol TCP
VBoxManage.exe setextradata "Ubuntu64" VBoxInternal/Devices/pcnet/0/LUN#0/Config/SSH/HostPort 22
VBoxManage.exe setextradata "Ubuntu64" VBoxInternal/Devices/pcnet/0/LUN#0/Config/SSH/GuestPort 22
VBoxManage.exe setextradata "Ubuntu64" VBoxInternal/Devices/pcnet/0/LUN#0/Config/SSH/Protocol TCP
VBoxManage.exe getextradata "Ubuntu64" enumerate