How to Configure Proxy Settings in Linux

How to Configure Proxy Settings in Linux


Here are two different ways to configure Linux to recognize a proxy server or proxy configuration file.

Export Command for Proxy Environment Variables

Personal kneeling in stone tunnel, photo credit jondoe via flickr

photo credit: jondoe

Use the following commands to configure your proxy for http and ftp traffic on the command line
export http_proxy=http://: export ftp_proxy=http://:

If your proxy requires login/authentication, you can use the format:
export http_proxy=http://username:password@::

To have this applied every time you log in, place these lines in your .bashrc in your home (~) directory.
export http_proxy=http://:
export ftp_proxy=http://:

Network Proxy Settings

For GNOME, go to Computer->Desktop Preferences->Network Proxy
For KDE desktop manager, you can get to the network proxy settings under System Settings > Network Settings > Proxy

In the setting, you can configure either by your proxy server and port, by the network, or a file via a URL/file location (e.g. http://myproxyserver:port/proxyfile.pac) .

These settings work with most other applications (e.g. other browsers like Chrome, OS commands).

Program/Application Level

Some applications and commands need to be configured individually. Below are some common examples.

Firefox

You can manually set up the Firefox proxy in Options menu. Go to Options > Advanced > Settings.

Fedora – Yum Package Manager

yum proxy settings can be found in the file system at
/etc/yum.conf

Add a line to the file with the following information:
proxy=http://:
The next time you run yum, it will pick up that proxy.

For Ubuntu

Here is a similar how to article on configuring proxy settings in Ubuntu covering Synaptic Package Manager, Gnome, apt-get, and Firefox.

Advertisements
Install LAMP on Fedora and Run in 15 minutes – Apache, MySQL, PHP, and phpMyAdmin

Install LAMP on Fedora and Run in 15 minutes – Apache, MySQL, PHP, and phpMyAdmin


Below are steps to install the LAMP stack on a Fedora Linux server – Apache HTTP Server, MySQL (database software) and PHP (or Perl or Python) in about 15 minutes.

Things to know

  • Commands below are executed as root (or prefixed with sudo).
  • The steps have been tested on Fedora 14, Fedora 15, and Fedora 16 successfully.
  • Instead of localhost for the steps below, you may have to substitute your server’s IP address (e.g. 192.168.2.31).
  • If you are using another Linux distribution (e.g. Ubuntu, OpenSUSE), the install command executions and file locations may differ, but setup will be similar.
  • If you already have the packages installed, your package manager will tell you and you can skip the installation step.
  • Install commands below will install the latest stable releases.

Getting Ready with a Clean Slate (Optional)

If you want to start with a clean install, you can remove existing installations of the components of the LAMP stack first.

# yum erase httpd mysql mysql-server php php-mysql phpmyadmin

Be careful if you do execute this command and find some components are already installed and yum asks you if you want to uninstall them. For example, some KDE distributions install MySQL with KDE packages like Akonadi, so you can leave MySQL there.

Install all Apache Web Server, MySQL, PHP, and phpMyAdmin

With this command, you can install all the packages at once.

# yum install httpd mysql mysql-server php php-mysql phpmyadmin

Apache – Starting and Configuring Apache (HTTPD)

Configure Apache to start automatically (Optional):

# /sbin/chkconfig httpd on

To start the server process immediately:

# /etc/rc.d/init.d/httpd start

Check Apache is running

Open up a browser on your server and go to the web address:

http://localhost/

You should see a web page saying that Apache is running assuming your default Apache site (/var/www/html/) is empty.

 Get Started on a Website

If you want to get started with a website in Apache, you can find the root of the web server at /var/www/html/ and configuration files at /etc/httpd/

Other notes

Instructions on how to use iptables or system-config-firewall-tui to ensure port 80 is accessible from remote computers.

MySQL – Starting and Configuring MySQL

Start MySQL first if it isn’t already started. If you skip this step, a common error encountered is Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock” or /tmp/mysql.sock.

# /etc/rc.d/init.d/mysqld start

Some Fedora installations may already have MySQL running for KDE packages like Kontact, Kmail, and Akonadi, so MySQL may already be started.

Check MySQL is running

# mysqladmin version status

Set mysql root password

Go into the mysql command line to set the root password.

mysql -u root

Set the password of the root user in mysql at the mysql prompt. Do not forget to end your mysql command with a semicolon:

mysql> SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘yourpassword’);

If it is successful, this message appears:

Query OK, 0 rows affected (0.00 sec)

Exit the mysql prompt

mysql> quit

PHP – Check PHP works with Apache and MySQL

Create the following file in the Apache default site.

# echo “<?php phpinfo(); ?>” > /var/www/html/index.php

Go the address below. You should see a page describing PHP’s configuration and status:

http://localhost/index.php

To see the MySQL section, go to:

http://localhost/index.php#module_mysql

If the steps above succeeded, you can delete your test file with:

# rm -f /var/www/html/index.php

Configure server start up (Optional)

To start MySQL and Apache every time the server starts up, execute the following:

# chkconfig –levels 235 httpd on

# chkconfig –levels 235 mysqld on

phpMyAdmin – Configure Apache and phpMyAdmin

If you want to allow phpmyadmin connection from other locations other than localhost, then modify the following file. This setting is not recommended if you want to restrict who can access phpMyAdmin, but is common for server installations.

nano /etc/httpd/conf.d/phpMyAdmin.conf

Comment out these lines in the file:

<Directory /usr/share/phpMyAdmin/> 
order deny,allow 
deny from all 
allow from 127.0.0.1 
allow from ::1 
</Directory>

So the lines looks like:

#<Directory /usr/share/phpMyAdmin/> 
# order deny,allow 
# deny from all 
# allow from 127.0.0.1 
# allow from ::1 
#</Directory>

Restart Apache:

# /etc/rc.d/init.d/httpd restart

Check everything is working!

Now you are all set Apache, MySQL, and PHP are setup and you have phpmyadmin to help you administer the MySQL server. Access phpmyadmin at http://localhost/phpmyadmin. Use your MySQL root credentials you configured during the MySQL set up to log in. If you can log into the phpmyadmin application, everything works – Congratulations!

Helpful links for installing LAMP

Random thought:

Turn on the LAMP in your life.