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.
Warning!: If you had never used vim editor earlier, do that:
Now, visudo will open sudoers file. Add following string into User Aliases section:
1. Network
There are many solutions. But the more habitual for me are two:- Connecting a virtual machine as an virtual adapter with a proxy.
- 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 upSecond command will get a network configuration from the DHCP server. For the automatic configuration after booting, you must edit this file:
dhclient eth0
/etc/sysconfig/network-scripts/ifcfg-eth0For DHCP server:
ONBOOT=yesIf you want to set a static ip adress:
BOOTPROTO=dhcp
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 updateYou can use -y flag for answering "yes" to all questions.
3. Apache installing
For apache installing do following:
yum install httpdFor adding into autorun, you can use chkconfig.
chkconfig httpd onFor starting service, enter:
service httpd startAll apache configurations in /ect/httpd/conf/httpd.conf.
4. PHP installing
Installing:
yum install phpApache restarting:
service httpd restartAll configurations in /etc/php.ini.
5. User adding
I will adding user with name ssh_user.
useradd ssh_userpasswd will offer you enter new password for user. After that, you can try to login:
passwd ssh_user
su ssh_userNow, 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 nanoThis 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.
export EDITOR=nano
Now, visudo will open sudoers file. Add following string into User Aliases section:
ssh_user ALL = root ALLSave this file. New user will posible to run applications on behalf of root.
Комментариев нет:
Отправить комментарий