pondělí 25. listopadu 2013

CentOS 6.0 inside virtual box machine

I have tried the fresh installation inside the VM:
Booting  from the image downloaded from http://mirror.centos.org/centos/6/isos/x86_64/ I came to state, where the installation program is running, but it does not react to keyboard (VirtualBox console running in VNC viewer).

So I have downloaded the pre-installed CentOS 6.0 base x86_64 image form http://sourceforge.net/projects/virtualboximage/files/CentOS/6.0/CentOS-6-x86_64.7z/download
The text mode boots up flawlessly. After login  ("reverse" is the root pw) the system seems to work well. However, the network interface is not recognized.

1. Change keyboard layout from Italian to standard (us)
- edit the /etc/sysconfig/keyboard

2. LAN interface:
change persistent rules for networking:

cd /etc/udev/rules.d
vi 70-persistent-net.rules
delete the old (foreign) network card and change names of your interfaces

change hwadress in /etc/sysconfig/network-scripts/ifcfg-eth0
to match the true hw addresses (specified in Virtual Box configuration)
and
reboot

For static IP address configuration: see link
however, add DNS info into  /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
UUID=7....          # get uuid using "uuidgen eth0"
ONBOOT=yes
NM_CONTROLLED=no    # no network manager on this device
BOOTPROTO=static
IPADDR= 123.123.20.123
NETMASK=255.255.252.0
DNS1=123.123.20.10
DNS2=123.123.12.1
DNS3=8.8.8.8
DOMAIN="my.site.gov"
PEERDNS="yes"       # i.e. create /etc/resolv.conf
GATEWAY=123.123.20.31
DEFROUTE=yes        # i.e. use GW as default GW
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=E0:69:95:xx:xx:xx

Secondary IP addres for the primary interface:
edit /etc/sysconfig/network-scripts/ifcfg-eth0:1
DEVICE=eth0:1
BOOTPROTO=static
IPADDR=192.168.0.5
NETMASK=255.255.255.0
ONBOOT=yes
To activate: ifup eth0:1 Thanks.

Add static default route to  /etc/sysconfig/network
GATEWAY=123.123.20.31
 
Secondary ethernet adapter is set up by DHCP, it serves for local connections only:
edit /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
TYPE=Ethernet
UUID=0...           # get uuid using "uuidgen eth1"
ONBOOT=yes
NM_CONTROLLED=no  
BOOTPROTO=dhcp      # get IP address using dhcp
DEFROUTE=no         # no default route
PEERDNS=no          # do not use DNS from dhcp server
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="USB eth1"

3. software
clear installation cache according to documentation, the fastest mirror plugin is already active

update the distribution:
yum update
reboot
then check
cat /etc/redhat-release

ssh client, mc ... (ssh server is already running: take care of firewall /etc/sysconfig/iptables)
yum -y install openssh-clients 
yum -y install mc wget vim
yum -y install samba-client samba-common cifs-utils 

lsb and X11 base are necessary for ANSYS licence manager
yum -y install lsb

list available groups (patterns)
yum grouplist

install X11:
yum -y groupinstall "X Window System" "Desktop" "Fonts" "General Purpose Desktop"
yum -y install tigervnc-server
(thanks to this link)(running vnc as a service)(ssh tunnel for vncviewer)


I prefer Xfce4 for VNC desktop
yum -y groupinstall Xfce

Edit .vnc/xstartup:
vncconfig -iconic &
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
startxfce4

NTP client (see howto-install-ntp-to-synchronize-server-clock). Note, that if the time is too far off then ntpd may not be able to synchronize, but setting the correct time with ntpdate solve the issue (cf. the ntpdate call below).
yum -y install ntp ntpdate ntp-doc
chkconfig ntpd on
ntpdate time.ure.cas.cz
/etc/init.d/ntpd start
hwclock --systohc

Config: /etc/ntp.conf
server tik.cesnet.cz
server tak.cesnet.cz
server time.ure.cas.cz


install mysql, php (apache is already installed)
yum -y install mysql-server mysql php-mysql
service mysqld start
chkconfig --levels 35 mysqld on
service httpd start
chkconfig --levels 35 httpd on
yum -y install php php-mysql
yum -y install php-mbstring php-soap

Default www root is /var/www/http in CentOS, but I am used to have it in /srv/www. SELinux settings prevent in an easy change of the DocumentRoot. To disable SELINUX for http (various booleans/setsebool hints do not work in 6.4):
yum -y install policycoreutils-python
semanage permissive -a httpd_t
or better: correct the security context for new www root:
chcon -Rv --type=httpd_sys_content_t  /srv/www


Edit /etc/httpd/conf/httpd.conf :
DocumentRoot "/srv/www/htdocs"

FTP server: (SElinux has to be disabled with this setup)
yum -y install vsftpd xinetd lftp
edit /etc/vsftpd/vsftpd.conf:
anonymous_enable=YES
anon_root=/srv/ftp
anon_upload_enable=YES
local_enable=YES
write_enable=YES
local_umask=022
xferlog_enable=YES
xferlog_std_format=YES
deny_email_enable=YES
banned_email_file=/srv/vsftpd.banned_emails
userlist_enable=YES
userlist_deny=NO
userlist_file=/etc/vsftpd/user_list
and add allowed users into /etc/vsftpd/user_list file:
anonymous
userA
userB

The fake login shells have to be present in /etc/shells. Otherwise you cannot log in in ftp.
useradd --home-dir /srv/userA --no-create-home --shell /sbin/nologin userA 
useradd --home-dir /srv/userB --no-create-home --shell /sbin/nologin userB 

Default permissions for anonymous user's directory:
chown -R ftp. /srv/ftp
chmod 733 /srv/ftp/upload/
chmod 555 /srv/ftp /srv/ftp/pub/

xinetd: /etc/xinetd.d/vsftpd
service ftp
{
        socket_type             = stream
        protocol                = tcp
        wait                    = no
        user                    = root
        server                  = /usr/sbin/vsftpd
        disable                 = no
}

service xinetd start
chkconfig xinetd on

Žádné komentáře:

Okomentovat