Friday, February 12, 2016

How to Install pep8 utility in Python 2.6.6

Python 2.6.6 doesn't include pep8 utility by default. This can be installed by using the pip (Pip Installs Packages) package manager. However, even pip isn't available by default with Python 2.6.6.

The following steps help with installing pip and then pep8.

  • Download get-pip.py from bootstrap.pypa.io/get-pip.py.

  • Install pip by running the following command:

    C:\Python26>python.exe get-pip.py

    Once pip is installed, the pip utility can be found at C:\Python26\Scripts\pip.exe.

  • Now use the pip package manager to download pep8.

    C:\Python26\Scripts\pip.exe install pep8

    Once the installation completes, the pep8 utility can be found at C:\Python26\Scripts\pep8.exe.

Wednesday, February 10, 2016

How to Manage Software Repositories in RedHat Enterprise Linux

Software management is performed using the 'yum' utility in RedHat Enterprise Linux. Software sources or software repositories could be a media (cd), nfs or a ftp location.

  • Add a new repository:

    To add a new repository, first create a file under /etc/yum.repos.d/example.repo. Remember that the extension has to be .repo. Then run the following command to validate the repository.

    ]# yum repolist

    If the information provided in the .repo file is verified, the repository will be contacted and the file_list gets downloaded. Software hosted by that repository can then be installed onto the system.

  • Enable/Disable a repository:

    To enable an already added repository, run the following command.

    ]# yum-config-manager --enable repo_name

    To disable a repository, run the following command.

    ]# yum-config-manager --disbale repo_name

  • Delete a yum repository:

    To delete a yum repository, first delete the .repo file created at /etc/yum.repos.d/ and then run the following command. This would update the list of repositories.

    ]# yum repolist

  • List all available repositories with details:

    To list all available repositories with full details, run the following command.

    ]# yum-config-manager

Monday, February 8, 2016

How to Enable Remote Connections to a PostgreDB

The following steps can be followed to enable remote connections to Postgres Database.

1. First set a password for 'postgres' in psql, if there's already a password set, move onto next step.

~]# sudo -u postgres psql

postgres=# \password postgres
postgres=# \q

2. Next, enable Postgres service to listen on all ports. As 'root' user, edit the following file and add the line shown below and save the file. An editor like vi/vim maybe used for this task.

~]# vim /var/lib/pgsql/9.3/data/postgresql.conf

listen_addresses = '*'          # what IP address(es) to listen on;

3. Next step is to modify the Postgres configuration to customize the which hosts are allowed to access the Database remotely. Edit the following file, scroll down to the IPv4 section and add the line shown below. This indicates that Postgres may accept connections from any host. Obviously, this can be customized as per the user's needs.

~]# vim /var/lib/pgsql/9.3/data/pg_hba.conf

host    all             all             0.0.0.0/0               md5

4. Finally, restart the postgres service

~]# service postgresql-9.3 restart

Any tool such as TOAD for Postgres or pgAdmin can be used to connect to the Database.