Use the flag -p with virtualenv command to specify the python version that you would want to use
$ virtualenv -p /usr/bin/python/2.7
For windows environment, use
c:\> virtualenv --python=c:\Python27\python.exe myenv
Different projects in python may require different modules and its dependencies. Also, there may be a necessity that certain projects be run on newer/older python releases hence introducing version conflicts. Virtual environment is a tool that helps you manage these scenarios.
To install virtualenv, use pip
$ pip install virtualenv
Now, create a virtual environment "myenv"
$ virtualenv myenv
To use the virtual environment, key in
$ source myenv/bin/activate
(if in windows, key in "myenv\Scripts\activate")
The name of your virtual environment will appear on the left of the prompt
(myenv) ...$
To exit out of the virtual environment, key in
$ deactivate
Visudo is needed to make modifications to the sudoers file. In a fresh install of CentOS "sudoers" file is not normally found. To install visudo issue the command$ yum -y install sudo
As a sys admin, you need to be careful when performing tasks with root privileges. To be cautious, you can create a new user and assign him with root privileges using "visudo"
$ /usr/sbin/visudo
# User privilege specification
root ALL=(ALL) ALL
test ALL=(ALL) ALL
In the above file, test is a new user created with root privileges. In order for the "test" user to have root privileges, command "sudo" should be used. It prevents the user from issuing any commands that can cause system wide havoc and it also logs the command inside "/var/log/secure" for review
Changing host configuration
$ vi /var/lib/pgsql/8.4/data/pg_hba.conf
Add postgresql to startup process
$ chkconfig postgresql-8.4 on
Start postgresql service
$ service postgresql-8.4 start
Access postgresql
$ su - postgresql$ psql
Create database
postgres-# create database test
List databases
postgres-# \list
Exit postgresql
postgres-# \q (or \quit)
Connect to database
postgres-# \c test (\connect test)
First lets do an update before we start installing PostgreSQL
$ yum update
You can install PostgreSQL from CentOS Base repo or can do a search for the latest version and install it based on your needs. Method 1 describes manual setup and Method 2 indicates an install from CentOS base repo (more…)