网络配置
# 重启网络管理器
$ service network restart
# 查看IP地址
$ ip addr
# 修改IP配置
$ cd /etc/sysconfig/network-scripts/
# 安装VIM
$ yum install -y vim
# 安装netstats
$ yum install -y net-tools
# 使用netstat查看22端口
$ netstat -an|grep 22
$ ifconfig
$ nmcli conn show -a
安装配置SSH
# 查看是否安装ssh包
$ rpm -qa|grep ssh
$ rpm -qa|grep openssh
# 安装ssh服务
$ yum install -y openssl-server
# 查看SSH版本与文件位置
$ ssh -v
$ whereis sshd
# 关闭selinux
$ setenforce 0
$ vim /etc/selinux/config
SLINUX=disabled
# 编辑修改ssh服务配置
$ vim /etc/sshd_config
Port=22
ListenAddress 0.0.0.0
PermitRootLogin no
RSAAuthentication yes
PubkeyAuthentication yes
PasswordAuthentication yes
# 重启并查看sshd服务
$ systemctl restart sshd.service
$ systemctl enable sshd.service
# 防火墙添加22端口
$ firewall-cmd --permanent --zone=public --add-port=22/tcp
$ firewall-cmd --reload
$ firewall-cmd --list-all|grep 22
# 查看进程
$ netstat-antp|grep sshd
# 远程登录测试
$ ssh username@host
安装配置FTP
# 安装VSFTP服务器
$ yum install -y vsftpd
# 设置开机启动
$ systemctl enable vsftpd.service
# VSFTP服务器:启动、停止、重启、状态
$ systemctl start vsftpd.service
$ systemctl stop vsftpd.service
$ systemctl restart vsftpd.service
$ systemctl status vsftpd.service
# 查看配置文件路径
$ whereis vsftpd
# 配置FTP服务器
$ cd /etc/vsftpd/ && vim vsftpd.conf
安装GUI图形界面
# 安装Gnome包
$ yum groupinstall "GNOME Desktop" "Graphical Administration Tools"
# 检查是否安装成功
$ yum grouplist
# 更新系统运行级别
$ ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
# 图形界面的卸载
$ yum groupremove 'GNOME Desktop'
$ yum groupremove 'X Window System'
# 重启系统更新系统运行级别
$ reboot
使用VitualBox为虚拟机磁盘扩容
$ cd C:\Program Files\Oracle\VirtualBox
# 查看磁盘容量
$ VBoxManage.exe list hdds
UUID: 5eb5c114-84ce-4194-8490-02077f026e99
Parent UUID: base
State: locked write
Type: normal (base)
Location: D:\VirtualBoxVMs\CentOS7\CentOS7.vdi
Storage format: VDI
Capacity: 8192 MBytes
Encryption: disabled
UUID: fe1239dc-1f32-40d7-bd25-c3fb4de60e28
Parent UUID: base
State: locked write
Type: normal (base)
Location: D:\VirtualBoxVMs\CentOS7\NewVirtualDisk1.vdi
Storage format: VDI
Capacity: 8192 MBytes
Encryption: disabled
# 从8G扩容到20G
$ C:\Program Files\Oracle\VirtualBoxVBoxManage.exe modifyhd "D:\VirtualBoxVMs\CentOS7\CentOS7.vdi" --resize 20480
下载分区管理工具 Gparted Live CD
VirtualBox 虚拟机中打开设置选择存储,在【控制器:IDE】的属性中分配光驱并加载Gparted镜像文件。
启动系统后,选择【GParted Live】
进入分区管理,选择磁盘标识,并调整大小。
查看磁盘空间
$ df -hT
Virtualbox虚拟机中无法显示鼠标指针
点击【设置】>【显示】> 【屏幕】>【Graphical Controller】>【VBoxVGA】
Virtualbox安装增强工具
安装Vscode
$ rpm -qa
$ rpm -ql code
$ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
$ sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'
$ yum check-update
$ sudo yum install code
$ code --version
安装PHP7.2
# 创建用户和组
$ groupadd www
$ useradd -g www www
# 安装依赖
$ yum install -y wget vim pcre pcre-devel openssl openssl-devel libicu-devel gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses ncurses-devel curl curl-devel krb5-devel libidn libidn-devel openldap openldap-devel nss_ldap jemalloc-devel cmake boost-devel bison automake libevent libevent-devel gd gd-devel libtool* libmcrypt libmcrypt-devel mcrypt mhash libxslt libxslt-devel readline readline-devel gmp gmp-devel libcurl libcurl-devel openjpeg-devel
$ yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl open