VisualBox 安装 CentOS 7.6 操作记录

20181213 VisualBox 安装 CentOS 7.6 操作记录

1、下载

官网下载地址: https://wiki.centos.org/Download
找到
	i386   Everything (ISO), Minimal (ISO), NetInstall (ISO)
选择 阿里云镜像 下载
	http://mirrors.aliyun.com/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-DVD-1810.iso

2、 开始安装,记住鼠标切换键 : 左边的 Win !切记!切记!切记!

安装过程(以及以后运行中)只要操作鼠标就会弹出警告提示: 
前面一大堆英文( 意思就是 : 是否 Capture ?)
注意记住切换提示:
The host key is currently defined as Left ⌘.

3、CentOS 7 不分服务器版和桌面版!

我也不知道在哪里选择,总共操作过 2 次,正好桌面版和Server版都看到过!我要的是 Server

4、首次启动时,没有 网卡地址 (最好直接以 root 登录)

ip a
看到我的网卡名字:enp0s3 ,但是没有分配 ip

虚拟机 : Network —Network setting —Bridget adapter
桥接方式也没有 ip地址!

如果不是 root 登录,先 su 切换到 root
cd /etc/sysconfig/network-scripts
vim ifcfg-enp0s3
到最后一行,修改为YES
ONBOOT=YES

重启网卡服务
	systemctl restart network.service

ip a
返回结果:
	1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
		link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
		inet 127.0.0.1/8 scope host lo
		   valid_lft forever preferred_lft forever
		inet6 ::1/128 scope host 
		   valid_lft forever preferred_lft forever
	2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
		link/ether 08:00:27:63:e6:f5 brd ff:ff:ff:ff:ff:ff
		inet 192.168.1.100/24 brd 192.168.1.255 scope global noprefixroute dynamic enp0s3
		   valid_lft 3253sec preferred_lft 3253sec
		inet6 fe80::ba3f:1d96:dc67:fbf3/64 scope link noprefixroute 
		   valid_lft forever preferred_lft forever
操作到这里就可以离开虚拟机 ,直接以 root 用户身份 ssh 登录!
可以先确认一下 sshd 是否安装、运行
ps -ef |grep sshd

5、安装基本工具,将 dhbm 加入 sudo

yum install vim
yum install wget

用 root ssh 登录 ,或者 su 切换到 root

vi /etc/sudoers
找到并且按照这行增加一行 dhbm 
	root    ALL=(ALL)       ALL
	dhbm 	ALL=(ALL)	ALL

操作到这里就可以 exit ,重新以 dhbm 用户身份 ssh 登录!

6、 切换国内源 (阿里云)

1)、参考
https://blog.csdn.net/Pipcie/article/details/80005006

2)、查看目前 源 列表
yum repolist
返回结果:
	已加载插件:fastestmirror
	Determining fastest mirrors
	 * base: mirrors.163.com
	 * extras: mirrors.cn99.com
	 * updates: mirrors.163.com
	base                                                     | 3.6 kB     00:00     
	extras                                                   | 3.4 kB     00:00     
	updates                                                  | 3.4 kB     00:00     
	(1/4): extras/7/x86_64/primary_db                          | 156 kB   00:00     
	(2/4): base/7/x86_64/group_gz                              | 166 kB   00:00     
	(3/4): base/7/x86_64/primary_db                            | 6.0 MB   00:03     
	(4/4): updates/7/x86_64/primary_db                         | 1.3 MB   00:03     
	源标识                              源名称                                状态
	base/7/x86_64                       CentOS-7 - Base                       10,019
	extras/7/x86_64                     CentOS-7 - Extras                        321
	updates/7/x86_64                    CentOS-7 - Updates                       599
	repolist: 10,939
3)、下载、加载 阿里云镜像源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache
再次查看 yum repolist
返回结果:
	已加载插件:fastestmirror
	Loading mirror speeds from cached hostfile
	 * base: mirrors.aliyun.com
	 * extras: mirrors.aliyun.com
	 * updates: mirrors.aliyun.com
	源标识                   源名称                                           状态
	base/7/x86_64            CentOS-7 - Base - mirrors.aliyun.com             10,019
	extras/7/x86_64          CentOS-7 - Extras - mirrors.aliyun.com              321
	updates/7/x86_64         CentOS-7 - Updates - mirrors.aliyun.com             599
	repolist: 10,939

4)、添加第三方EPEL源 (还是选 阿里云)
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache

再次查看 yum repolist
返回结果:
	已加载插件:fastestmirror
	Loading mirror speeds from cached hostfile
	 * base: mirrors.aliyun.com
	 * extras: mirrors.aliyun.com
	 * updates: mirrors.aliyun.com
	源标识                源名称                                              状态
	base/7/x86_64         CentOS-7 - Base - mirrors.aliyun.com                10,019
	epel/x86_64           Extra Packages for Enterprise Linux 7 - x86_64      12,746
	extras/7/x86_64       CentOS-7 - Extras - mirrors.aliyun.com                 321
	updates/7/x86_64      CentOS-7 - Updates - mirrors.aliyun.com                599
	repolist: 23,685

** 注意:多出来一个epel/x86_64  Extra Packages for Enterprise Linux 7 - x86_64

7、禁止root账户ssh远程登录

sudo vim /etc/ssh/sshd_config
找到 PermitRootLogin 
去掉这行的注释 # 
yes更改为no 

重新加载 sshd 服务
	sudo systemctl restart sshd

再次尝试 root ssh 远程登录
ssh [email protected]
	[email protected]'s password: 
	Permission denied, please try again.
	[email protected]'s password: 

8、安装 LAMP

待继续

猜你喜欢

转载自my.oschina.net/u/1440971/blog/2987991