Running a recent Git for Ubuntu can sometimes be problematic. The Git version in the offical Ubuntu archives lags behind the maintainers, stable, version. To solve this install the Maintainers team version.
- Add the PPA (personal Packages Archive) to your apt sources
sudo add-apt-repository ppa:git-core/ppa
- if add-apt-repository is not installed, install it with
apt-get install python-software-properties
sudo apt-get update && sudo apt-get install git
In a corporate envrionment the case of an unverified key can rise a problem. Cause is that
apt-key adv --recv-keys ;
may not work behind some firewalls. to solve this issue, follow these steps:
- Open http://keyserver.ubuntu.com/ in a Browser
- and search for the offending key. Don’t forget to mark the string as hex by prepending 0x.
- Get key from Ubuntu keyserver
- Insert into a file
apt-key add <file>
For details see http://opensourceforgeeks.blogspot.in/2013/04/w-gpg-error-httpppalaunchpadnet-precise.html
If you want to hide a ssh service to the public use a reverse ssh proxy. Just as Apache can act as a reverse http / https proxy, so can HA Proxy act as a reverse ssh proxy.
Why just don’t use port forwarding? Well, suppose you have a service like GitLab or Stash to serve your upstream Git repository and you want to access your reverse proxy host and your service host by ssh on port 22? Then HAProxy is in my opinion the easiest option to forward the SSL service port to a backend server.
Bear in mind to upgrade your firewall on the proxy host.
Here is a sample configuration file.
# this config needs haproxy-1.1.28 or haproxy-1.2.1
# Customized to use a ssh proxy
log 127.0.0.1 local0
#log 127.0.0.1 local1 notice
#log loghost local0 info
bind *: <port>
timeout client 1h
server <server-ip:check port
In this post I will point out the steps to shrink logic volumes.
The order of shrinking is just the reverse of expanding:
- un-mount the file system
- check file system integrity
- shrink file system
- shrink logic volume.
The steps in detail
1. First un-mount the file system to make sure no one has access anymore. For some file systems you must switch to single user mode for this. Then check the file system integrity.
# /yyy is the mount point
sudo umount /yyy
# This is the logical volume. vg-xxx is the volume group
# and yyy is the symbolic name of the lv.
sudo e2fsck -f /dev/mapper/vg-xxx/yyy
2. Shrink the file system to some point
sudo resize2fs /dev/mapper/vg-xxx/yyy 2000M
Here it goes down to 2G, but above the physical size of existing files. This command works for both ext2 and ext3.
3. Shrink the logic volume
sudo lvresize -L -1G /dev/mapper/vg-xxx/yyy
Here the logic volume is shrunk by 1G. Don’t shrink beyond your file system size, the consequences are disatrous. Do the math.
4. Expand the file system to fit the shrunk logic volume
sudo resize2fs -p /dev/mapper/vg-xxx/yyy
5. Remount the file system.
Logical volumes are easy to extend. The basic steps are like this: check free space –> expand logic volume –> expand file system. You can do it even with file system mounted.
Although I recommend to make a backup first and switch to single user mode if it is a server.
Here’s the recipe:
1. Check the mounted file system with
2. Check the available logic volumes
3. Check how much free space available in this volume group for the growth
4. Now resize the logic volume up to some point (of course within the free space limit)
sudo lvresize -L +1GB /dev/mapper/vg-xxx/yyy
5. Check the new size of the logic volume
6. Expand the existing file system to the size of logic volume
sudo resize2fs -p /dev/mapper/vg-xxx/yyy
This command works for both ext2 and ext3 file systems.
Here’s my personal preference for an allround Linux box. The following volume layout is a baseline. If the machine is a server reduce /home and add much more to /var where normally you data lives. For a development box increase /home for all your projects.
I use the lvm2 package, so these commands use the most common options.
With fdisk /dev/sda
- /dev/sda1 -> /boot ext3, 256MB
- /dev/sda2 -> pvcreate /dev/sda2 -> vgcreate vg0 /dev/sda
With lvm2 tools
- pvcreate /dev/sda2
- vgcreate vg0 /dev/sda
- lvcreate -L 2G – n root vg0 -> ext3 mount on /
- lvcreate -L <depending on memory and disksize> -n swap vg0 -> use as swaparea
- lvcreate -L 2G -n usr vg0 -> ext3 mount on /usr
- lvcreate -L 512M -n tmp -vg0 > ext3, mount on /tmp
- lvcreate -L <512M – 2G> -n home vg0 -> ext3, mount on /home
- lvcreate -L 256M -n opt vg0 -> ext3, mount on /opt
- lvcreate -L 512M -n usrlocal vg0 -> ext3, mount on /usrlocal
- lvcreate -L <1G – nG> -n var vg0 -> ext3, mount on /var
/dev/sd[b..z] -> extend pv and use where the bulk data is, normally var
This is just a short example how I use the Linux file system. A full discussion with lot’s of links you will find on Wikipedia. The home of the Linux File System Hierarchy is here.
The layout below is the (almost) default of Debian and Ubuntu distributions.
Just for personal settings, annotations and workspaces.
Classic place to put everything short living. Probably best to (automatically) clean it out regularly.
Static and dynamic websites
Database data-files, if big put on its own logical volume.
Any other non-web, non-db data or archive files.
Other distributions use slightly different file system layouts and the data-files are maybe in different folders, but as mentioned earlier this is my personal approach.