HowTo

HowTo: Install Squid proxy server in Ubuntu

Squid is a proxy http server that speeds up getting pages from the internet by keeping copies of commonly accessed pages or graphics instead of downloading them each time. To install it:-

1. From a root terminal type

sudo apt-get install squid

2. Open

sudo gedit /etc/squid/squid.conf

3. Find the TAG: visible_hostname and after the comments section add visible_hostname where is your machine’s hostname.

4. Check http_port is either set to 3128 or a port number that you can remember for configuring your browser.

5. Close and save

6. Type adduser squid and specify a password

7. Restart squid by typing:

sudo /etc/init.d/squid restart

8. Stop the service by typing

sudo /etc/init.d/squid stop

9. Test it in debug mode by typing

sudo squid -z

(which creates the cache files)

10. Type

sudo squid -NCd10

to test squid in debug mode and leave it running.

11. Open Firefox and type the URL localhost:3128 or whatever port you chose. It will fail to retrieve a page, but at the bottom it will confirm that the error is generated by squid.

12. Back at the Terminal type CTRL-C to cancel the debug mode

13. Start squid for real with

sudo /etc/init.d/squid start

It will start automatically from now on.

14. To configure Firefox to use squid, go to Edit>Preferences and click Advanced.

15. Click Network>Settings and then Manual Proxy Configuration. For http proxy, enter localhost and for port 3128 (or whichever port you chose).

16. Then click OK and close the Preferences dialogue.

17. Now go to any webpage. If you get the page, it’s working!

[ad] Empty ad slot (#1)!


HowTo: Redirect the all HTTP traffic

If you would like to redirect the all HTTP traffic through the proxy without needing to set up a proxy manually in all your applications you will need to add some rules

iptables -t nat -A PREROUTING -i eth1 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.0.1:3128
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128

Where eth1,eth0 are the LAN, WAN devices and 192.168.0.1 is the IP address of your LAN device.

[ad] Empty ad slot (#1)!

HowTo: Install MySQL Server 5 on Ubuntu

Installing MySQL 5 Server on Ubuntu is a quick and easy process. It almost feels like it should be more difficult.

Open a terminal window, and use the following command:

sudo apt-get install mysql-server

During the installation of MySQL the installer will ask you to enter the password of the root or the main admin of your database server.

If you are running PHP you will also need to install the php module for mysql 5:

sudo apt-get install php5-mysql

To create a new database, use the mysqladmin command:

mysqladmin create [databasename]

[ad] Empty ad slot (#1)!