Post Install tuning for CentOS 7 in VirtualBOX

VirtualBox Linux additions 

VirtualBox Linux Additions
mount /dev/cdrom  /mnt/
./VBoxLinuxAdditions.run
umount /mnt

CentOS  console resolution

/etc/default/grub
vi /etc/default/grub
GRUB_CMDLINE_LINUX=".. quiet vga=792"
GRUB_DISABLE_RECOVERY="true"
GRUB_GFXMODE=1024x768x32
GRUB_GFXPAYLOAD_LINUX=keep
grub2-mkconfig -o /boot/grub2/grub.cfg

 Adding dates to bash history by adding next strings to /etc/bashrc 

/etc/bashrc
HISTTIMEFORMAT="%Y-%m-%d %T "
HISTSIZE=20000
HISTCONTROL=ignoredups:erasedups
shopt -s histappend

configure network

nmtui
nmtui
Network Manager TUI
┌───────────────────────────┤ Edit connection ├───────────────────────────┐
│                                                                         │
│         Profile name LAN_____________________________________           │
│               Device 08:00:27:B1:B6:15 (eth0)________________           │
│                                                                         │
│ ═ ETHERNET                                                    <Show>    │
│                                                                         │
│ ╤ IPv4 CONFIGURATION <Manual>                                 <Hide>    │
│ │          Addresses 10.9.8.244/24____________ <Remove>                 │
│ │                    <Add...>                                           │
│ │            Gateway _________________________                          │
│ │        DNS servers <Add...>                                           │
│ │     Search domains <Add...>                                           │
│ │                                                                       │
│ │            Routing (No custom routes) <Edit...>                       │
│ │ [ ] Never use this network for default route                          │
│ │                                                                       │
│ │ [X] Require IPv4 addressing for this connection                       │
│ └                                                                       │
│                                                                         │
│ ═ IPv6 CONFIGURATION <Ignore>                                 <Show>    │
│                                                                         │
│ [X] Automatically connect                                               │
│ [X] Available to all users                                              │
│                                                                         │
│                                                           <Cancel> <OK> │
└─────────────────────────────────────────────────────────────────────────┘
nmcli
nmcli device
nmcli connection
nmcli networking 

 

SELinux

setsebool httpd_can_network_connect
setsebool -P httpd_can_network_connect 1 

disable selinux

cat /etc/sysconfig/selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/sysconfig/selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
reboot

chkconfig/services

systemctl list-units
systemctl enable httpd 
systemctl stop httpd.service
systemctl start httpd.service
systemctl restart httpd.service
systemctl reload httpd.service   
systemctl status httpd

IPTables

Permanently open Port 80/TCP

firewall-cmd --zone=public --add-port=80/tcp --permanent   
firewall-cmd --reload  

Reboot by user 

systemctl reboot -i

 

Switch from Java 7 to Java 8

yum install java-1.8.0-openjdk
alternatives --config java 

 

Add host to known_hosts

ssh-keyscan -H www.liutyi.info >> ~/.ssh/known_hosts

 

Start using NFS Server

yum install nfs-utils
systemctl enable rpcbind
systemctl enable nfs-server
systemctl start rpcbind
systemctl start nfs-server
systemctl start rpc-statd
systemctl start nfs-idmapd
vi /etc/exports
exportfs -r

 

Clean boot partition

# leave only two latest kernels
package-cleanup --oldkernels --count=2
  • No labels