Saturday, March 3, 2012


APT-PROXY Configuration
Apt-proxy is caching proxy can be easily install on ubuntu/debain. It will build up a partial debian mirror, and caches the packages in your hard drive it will behaves full http proxy server. In the case of missing packages the apt-proxy will fetch the missing package from internet and that will save your installation time and bandwidth, it's also clean the unused files based on user defined attributes in configuration file. apt-proxy is also accessible through ftp:// protocol.


Install proxy on your proxy server from any of debain/ubuntu mirror.

Install Apt-proxy 
        $> apt-get install apt-proxy


Open the apt-proxy configuration file which contains the default apt-proxy settings, Add mirrors in apt-proxy-v2.conf define the IP, PORT and cache-dir where you want to store download packages.


  $>  vi /etc/apt-proxy/apt-proxy-v2.conf    



      address 192.168.1.12
        port = 9999;
        cache-dir= “/var/cache/apt-proxy”
        timeout = 30
        passive_ftp = on


        [ubuntu]
        ; Ubuntu archive
        backends =
        http://archive.ubuntu.com/ubuntu
        http://de.archive.ubuntu.com/ubuntu
        [ubuntu-security]
        ; Ubuntu security updates
        backends = http://security.ubuntu.com/ubuntu
        [debian]        ; Backend servers, in order of preference
        backends =
        http://ftp.us.debian.org/debian
        http://ftp.de.debian.org/debian
        http://ftp2.de.debian.org/debian
        ftp://ftp.uk.debian.org/debian
        [debian-non-US]
        ; Debian debian-non-US archive
        backends =
        http://ftp.us.debian.org/debian-non-US
        http://ftp.th.debian.org/debian-non-US
        ftp://ftp.us.debian.org/debian
        [security]
        ; Debian security archive
        backends =
        http://security.debian.org/debian-security
        http://ftp2.de.debian.org/debian-security
        [openoffice]
        ; OpenOffice.org packages
        backends =
        http://ftp.freenet.de/pub/debian-openoffice
        http://ftp.sh.cvut.cz/MIRRORS/OpenOffice.deb
        http://borft.student.utwente.nl/debian
        [apt-proxy]
        ; Apt-proxy new versions
        backends = http://apt-proxy.sourceforge.net/apt-proxy


Initializing apt-proxy
You’re apt-proxy is ready to use, to start/restart you’re apt-proxy server run


$> /etc/init.d/apt-proxy [start|restart]


Export HTTP_PROXY
If you are using http proxy to connect though internet you need to define the proxy setting in your server. To define the proxy settings you  run


$> export http_proxy=http://username:password@myproxyserver:port/
$> export ftp_proxy=http://username:password@myproxyserver:port/


You need to export http proxy setting each time your server restarted to fix the add above lines in /etc/bash.bashrc file.


Client Setting
Edit source.list (/etc/apt/source.list) to use your proxy server instead of using internet.
Replace the existing mirrors


deb http://archive.ubuntu.com/ubuntu dapper main restricted
deb http://security.ubuntu.com/ubuntu dapper-security main restricted universe
archive.ubuntu.com will be replace with your server address and port it would become 
deb http://myProxyServerIp:port/ubuntu dapper main restricted
deb http://myProxyServerIp:port /ubuntu-security dapper-security main restricted universe


$>apt-get update

Enjoy your local proxy server.

AWS EC2 - SSH locked with UFW

Need to update the instance's user data: 1. Stop the instance 2. Right click (windows) or ctrl + click (Mac) on the instance to open a c...