суббота, 24 мая 2014 г.

CentOS installing and configuring

I'm installing CentOS minimal. I downloaded last version from the official site and installed it in VirtualBox. Earlier I worked only with Ubuntu and Gentoo and this is new for me. Here I want to tell about network configuration, user creation, and server installing.

1. Network

There are many solutions. But the more habitual for me are two:

  1. Connecting a virtual machine as an virtual adapter with a proxy.
  2. Saving the default configuration with NAT and configuring a port forwarding. It is simple but not flexibly.
I'll describe second solution. You can find first solution in the article "Raspberry Pi without monotor". For port forwarding press the button in the network configuration window and configure it as on the screen below. (Note: you must run Virtual Box with root rights)
Port forwarding window
Now, you can test networking. Enter following commands:
ifconfig eth0 up
dhclient eth0
Second command will get a network configuration from the DHCP server. For the automatic configuration after booting, you must edit this file:
/etc/sysconfig/network-scripts/ifcfg-eth0
For DHCP server:

ONBOOT=yes
BOOTPROTO=dhcp 
If you want to set a static ip adress:
DEVICE=eth0
BOOTPROTO=static
NM_CONTROLLED=yes
ONBOOT=yes
TYPE=Ethernet
IPADDR=<address>
NETMASK=<mask>
NETWORK=<сеть (ip address with a mask)>
BROADCAST=<broadcast>
GATEWAY=<gateway>

2. Cent OS upgrading. 

Just enter the following command:
yum update
You can use -y flag for answering "yes" to all questions.

3. Apache installing

For apache installing do following:
yum install httpd
For adding into autorun, you can use chkconfig.
chkconfig httpd on
For starting service, enter:
service httpd start
All apache configurations in /ect/httpd/conf/httpd.conf.

4. PHP installing 

Installing:
yum install php
Apache restarting:
 service httpd restart
All configurations in /etc/php.ini.

5. User adding

I will adding user with name ssh_user.
useradd ssh_user
passwd ssh_user
passwd will offer you enter new password for user. After that, you can try to login:
su ssh_user
Now, you must to configure sudo. This can be done with visudo util.
Warning!: If you had never used vim editor earlier, do that:
yum install nano
export EDITOR=nano
This operations will install simple editor "nano" and set it as default editor. Now, when you will call visudo, it in order will calling nano. If you will mistakes in configuration, visudo will asking you, what to do next. Answer "e", and editing will continue.
Now, visudo will open sudoers file. Add following string into User Aliases section:
ssh_user ALL = root ALL
Save this file. New user will posible to run applications on behalf of root.


Комментариев нет:

Отправить комментарий