How do I define nameservers in CentOS?

Last updated: March 28, 2011

To define your nameservers in CentOS you need to edit the resolv.conf file:

# vi /etc/resolv.conf

Add your nameservers as follows:

search example.com
nameserver X.X.X.X
nameserver Y.Y.Y.Y
nameserver Z.Z.Z.Z

Note: Max. three nameservers can be used/defined at a time.

Tags: centos, nameservers




How do I install PHP from source on CentOS?

Last updated: March 28, 2011

PHP installation in Linux OS

  1. Download PHP of latest version http://in.php.net/distributions/php-5.2.13.tar.gz
  2. gunzip php-xxx.tar.gz
  3. tar -xvf php-xxx.tar
  4. cd php-xxx
  5. Now, configure your PHP. This is where you customize your PHP with various options, like which extensions will be enabled. Do a
    ./configure --help for a list of available options.

./configure --prefix=/usr --with-apxs=/usr/bin/apxs

  1. make
  2. make install
  3. Setup php.ini file:


cp php.ini-xxx /usr/local/lib/php.ini
We can edit php.ini file to set PHP options.

1. Edit httpd.conf to load PHP module. The path on the right hand side of the LoadModule statement must point to the path of the PHP
module on your system. The make install from above may have already added this for you, but be sure to check.

LoadModule php5_module libexec/libphp5.so

2. Tell Apache to parse certain extensions as PHP

AddType application/x-httpd-php .php .phtml

3. Restart Apache in the server.

/etc/init.d/httpd restart

You can confirm PHP is working fine by putting a test PHP script in the document root.

Sample test script “info.php”:
<?php
phpinfo();
?>

Tags: centos, php




How do I install PHP on CentOS?

Last updated: March 29, 2011

Installing PHP on CentOS is easy using yum.

From the command line:
yum install php

Tags: yum, centos, php, linux




How do I create an alias in CentOS?

Last updated: March 29, 2011

When you become comfortable in a shell environment you start to look for ways to speed up your workflow and a great way to do that is by using aliases. An alias allows you to enter a word that you define that represents a different word, phrase or command.

To create an alias in CentOS first you need to open your .bashrc file in an editor and add an alias declaration. Each user has their own .bashrc file and the aliases in each of those files only apply to those users when logged into their own account so the aliases for the root user will be in here:

/root/.bashrc

But the aliases for a user named bob would be in here:

/home/bob/.bashrc (if that was the user bob's home directory)

Ok lets look at the syntax.

A basic alias looks like this:

alias keyword='target'

Where keyword is the word you will enter and target is the word, phrase or command that will actually be entered in the shell.

Lets say you are logged in as root and you commonly wish to access a remote server via ssh. Open the .bashrc file in /root in your favorite text editor (we will use vi).

Add a new entry in this format:

alias myserver='ssh root@192.0.32.10'

save the file and close your shell. Open a new shell to be able to use the new alias and type myserver and then enter (or return) and it will be just as if you had typed ssh root@192.0.32.10

Each alias goes on it's own line in .bashrc and remember you won't be able to use the alias until you open a new shell.

Tags: centos, linux, bash, cli




How do I delete a user in Linux?

Last updated: March 28, 2011

To delete a user in Linux you use the userdel command.

# userdel someusername

If you wish to also remove their home directory and mail spool file at the same time use the r option.

# userdel -r someusername

Tags: centos, linux, bash, cli




How do I copy a directory and it's contents in Linux?

Last updated: March 28, 2011

To copy a directory and all it's contents in Linux use the cp command with the a option.

# cp -a source destination

Source is the name of your directory and destination is the name you wish for the copy.

Tags: centos, linux, bash, cli




E-VS Drupal Stack for CentOS

Last updated: June 29, 2011

Welcome to the pre-configured E-VS Drupal Stack for CentOS by Network Redux.

  • Apache
  • MySQL
  • PHP
  • Apache Solr on Tomcat
  • Drush

Solr available through - http://ipaddress:8080/solr/

DocumentRoot

All sites will live under the user deploy with a DocumentRoot of /home/deploy/www – To create a new site, please see the example under that directory as your reference.

VirtualHost

Creating new sites can be done by making a new virtualhost under /etc/httpd/conf.d/ - You may refer to the 'example.networkredux.conf' file as an example.

[root@example ~]# cat /etc/httpd/conf.d/example.networkredux.conf

    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /home/deploy/www/example.networkredux.com
    ServerName example.com
    ErrorLog logs/example.com-error_log
    CustomLog logs/example.com-access_log common

MySQL

By default can be accessed directly as the root user simply by typing mysql from the command line.

Tags: e-vs, drupal, optimized, centos