CentOS

From Network Security Wiki


This page is for CentOS specific information.

Downloading

Download the Minimal ISO from the following link:

http://www.centos.org/download/


Basic Network Configuration

There will be a file named ifcfg-eth0 in the location /etc/sysconfig/network-scripts/

vi /etc/sysconfig/network-scripts/

For DHCP:

ONBOOT=yes
BOOTPROTO=dhcp

or for Static IP:

ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.11
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=8.8.8.8
DNS2=4.2.2.2
service network restart

Verify

ip a


Using Yum through Proxy

vi /etc/yum.conf
proxy=http://proxy.domain.com:8080
# The proxy credentials for yum connections
proxy_username=username
proxy_password=password


Mediawiki Install in Centos

  • Apache's default document root is /var/www/html on CentOS
  • Configuration file is /etc/httpd/conf/httpd.conf
  • Additional configurations are stored in the /etc/httpd/conf.d/
yum -y install httpd
  chkconfig --levels 235 httpd on
/etc/init.d/httpd start

Testing PHP5/Getting Details About Your PHP5 Installation:

vi /var/www/html/info.php
 <?php
 phpinfo();
 ?>
http://192.168.0.100/info.php

Getting MySQL Support In PHP5

yum search php

Pick the ones you need and install them like this:

yum -y install php-mysql
yum install wget
yum install nano
sudo yum install php-xml php-mysql mysql-server mysql php-intl php-gd
chkconfig mysqld on
service mysqld start
mysql_secure_installation
mysqladmin -u root password 'new-password' (with the quotes)
mysql -u root -p
  CREATE USER 'wiki'@'localhost' IDENTIFIED BY 'THISpasswordSHOULDbeCHANGED';
  GRANT ALL PRIVILEGES ON *.* TO 'wiki'@'localhost' IDENTIFIED BY 'THISpasswordSHOULDbeCHANGED' WITH GRANT OPTION;
  FLUSH PRIVILEGES;
  SHOW GRANTS FOR 'wiki'@'localhost';
  exit;


mysql -u wiki -p
 CREATE DATABASE wikidatabase;  
 SHOW DATABASES;
 GRANT ALL PRIVILEGES ON wikidatabase.* TO 'wiki'@'localhost' IDENTIFIED BY 'THISpasswordSHOULDbeCHANGED' WITH GRANT OPTION;
 FLUSH PRIVILEGES;
 exit
wget http://releases.wikimedia.org/mediawiki/1.25/mediawiki-1.25.1.tar.gz
tar -zxf /root/mediawiki-1.25.1.tar.gz
ln -s mediawiki-1.25.1/ mediawiki
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT

Now that we have all the configuration in, we can list the rules to see if anything is missing.

iptables -L -n
iptables-save | sudo tee /etc/sysconfig/iptables


Misc

Locate

Mlocate maintains a database of all your files and is re-indexed once a day by default.

Installation:

yum install mlocate 

To re-index immediately:

sudo updatedb




References





{{#widget:DISQUS |id=networkm |uniqid=CentOS |url=https://aman.awiki.org/wiki/CentOS }}