Sometimes you prefer not to update a specific package in Linux. This may be because you don’t want to upgrade to a new version with new features but no security updates. Or maybe because upgrading requires a service restart that you want to avoid just yet. This was the case for me recently when a new version of Docker came up and upgrading would have restarted the docker daemon and stopped the running containers.
It is possible to exclude a package from being updated. On Linux RPM systems (RedHat, CentOS, Fedora, etc.) this is the command to install all updates but exclude a specific package (say docker):
sudo yum update --exclude=docker
On Debian-like systems (Debian, Ubuntu, Mint, etc.) it is slightly more convoluted because you need to hold a package first and then upgrade the system
sudo apt-mark hold docker && sudo apt-get upgrade
and remember to remove the hold when you’re ready to upgrade that package too
KeePass is one of my favourite software. It is a password manager which allows to store secure passwords and forget about them. All you need to do is to remember one single (strong) password to open the software and that’s it. Considering the amount of passwords one has to remember these days, there is a bad tendency to use weak memorable passwords – or even worse always the same password! KeePass is good choice since it is cross-platform, uses strong encryption algorithms, and can store data offline.
I’m currently using KeePass2 (update: I now use KeePassX) However, I noticed that if you install KeePass via the Ubuntu Software Center you won’t necessarily install the latest version and you won’t get the latest updates automatically. So here is the procedure to overcome this problem.
First, add the KeePass repository. For example, in Ubuntu:
where precise is the codename of the Ubuntu version (here 12.04 Precise Pangolin). If you don’t know the codename of the Linux version find it out with:
lsb_release -a
Then update the repository directory and install KeePass2:
sudo apt-get update
sudo apt-get install keepass2
Finally, open KeePass, click on on Help -> Check for updates and KeePass2 will update to the latest stable version. From now on, Ubuntu will update it automatically.
Update: I’m now using KeePassX which is a native port of KeePass for Linux and Mac OS.
A colleague of mine recently asked me to install the Groovy programming language on our Red Hat 6.5 server and to make it accessible to all users. I thought it would be a very straightforward task but a quick search on the Red Hat 6.5 official repositories didn’t return any package for Groovy.
The easiest way to install Groovy manually is via gvm. I followed this procedure to do it:
Log in as root
sudo -i
2. Retrieve the gvm install script and store it in a temporary file
curl –s get.gvmtool.net > /tmp/gvm.sh
3. Make the temporary file executable
chmod +x /tmp/gvm.sh
4. Run the install script
./tmp/gvm.sh
5. Complete the installation as requested at prompt
source "/root/.gvm/bin/gvm-init.sh"
6. Check that gvm is installed (this should return the help message explaining how to use gvm)
gvm help
7. Remove the temporary install script
rm /tmp/gvm.sh
8. Install groovy via gvm
gvm install groovy
9. Select the current version of groovy as default (at the time of writing version 2.4.3) and check that groovy is installed
Recently I had to install groovy on other Linux systems and discovered that that it is now much easier using sdkman, which is the evolution of gvm. This is the procedure to follow:
Every year in March and in October the clock changes in most countries for energy saving purposes. This has the annoying effect of messing up the current time on your server if the timezone is not set properly. Servers in Europe are often set up to UTC time. For example my web hosting provider explicitly says:
Note that any times specified are executed in the timezone of the server, and not your local timezone. Accordingly, you may need to make allowance for this when selecting when to run your cron job. Our servers run in the ‘UTC’ timezone because our client base is global, and it remains constant throughout the year with no changes for daylight saving.
This is a bit annoying for cron jobs as you need to do some calculations in case you want to run them at a specific local time.
Even if you don’t have sudo rights on your server, you can at least modify the time for a given user. For example, to change the timezone for the current user to a local time (e.g. Europe/London) run the following command and add it to your bash_profile to make the change permanent:
export TZ="Europe/London"
If you have full control on your server, you can change the timezone system-wide by symlinking /etc/localtime to the appropriate file in /usr/share/zoneinfo. For example, to set the timezone system-wide to the local time in Paris:
Let’s say you have a new user needing sudo access to a Linux server. How do you grant him/her this great privilege? First, explain to the new user that sudo rights allow to do pretty much anything on a Linux machine – including screwing everything up! – and that with greater power also comes greater responsibilities. Then, follow this procedure:
1. Open the command line
2. Create a new user (e.g. newusername) and add it to group wheel (members of this group have sudo rights):
sudo useradd -G wheel newusername
3. Set up the password for the new user. First, login as root:
sudo -i
Then set the password for the new user (e.g. newusername):
passwd newusername
Finally exit from root with:
exit
4. Test the newly created user and password by logging in as user newusername:
su - newusername
5. Test that the newly created user is in group wheel: