一、Linux 的历史
①创始人:Linus Torvalds(林纳斯·托瓦兹)
②发布时间:1991年10月5日
③核心:kernel
④衍生版本:常见的Ubuntu、RedHat、CentOS、Debain、Fedora、SuSE、Linux Mint、Gentoo、OpenSUSE、StartOS、Mandrake、FreeBSD等
⑤CentOS:(Community Enterprise Operating System,中文意思是:社区企业操作系统)是Linux发行版之一,它是来自于Red Hat Enterprise Linux依照开放源代码规定释出的源代码所编译而成。由于出自同样的源代码,因此有些要求高度稳定性的服务器以CentOS替代商业版的Red Hat Enterprise Linux使用。两者的不同,在于CentOS并不包含封闭源代码软件。
⑥CentOS与红帽关系:
CentOS在2014初,宣布加入Red Hat。
CentOS 加入红帽后不变的是:
1. CentOS 继续不收费
2. 保持赞助内容驱动的网络中心不变
3. Bug、Issue 和紧急事件处理策略不变
4. Red Hat Enterprise Linux 和 CentOS 防火墙也依然存在
变化的是:
1. 我们是为红帽工作,不是为 RHEL
2. 红帽提供构建系统和初始内容分发资源的赞助
3. 一些开发的资源包括源码的获取将更加容易
4. 避免了原来和红帽上一些法律的问题
二、安装虚拟机(VMware,Virtual box)
安装CentOS 6.5 安装解说地址:点这里
配置网络
[root@mylinux ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
修改:ONBOOT=no ==> ONBOOT=yes ==> 网卡是否开机启动
BOOTPROTO=dhcp ==> BOOTPROTO=static ==> 网络是如何获取'dhcp'或者'static'
增加:IPADDR=192.168.0.145 ==> IP地址
NETMASK=255.255.255.0 ==> 子网掩码
GATEWAY=192.168.0.1 ==> 网关地址
DNS1=202.96.128.166 ==> DNS1地址
DNS2=202.96.134.133 ==> DNS2地址
退出保存: esc : wq
重启网络服务:service network restart
或者:使用绝对路径 /etc/init.d/network restart
三、远程连接
软件:putty,Xshell,SecureCRT
通过秘钥进行SSH加密链接:
用PuttYgen生成秘钥,并保存好
# mkdir /root/.ssh/
# chmod 700 /root/.ssh/ <== 更改目录权限
# vi /root/.ssh/authorized_keys <== 将秘钥粘贴进来,退出保存
# chmod 600 /root/.ssh/authorized_keys <==更改文件权限
# setenforce 0 <== 临时关闭selinux
永久关闭selinux
# vi /etc/selinux/config <==修改selinux配置
修改SELINUX=enforcing ==> SELINUX=disabled
注:selinux三个选项:enforcing,开启SELINUX安全防护
permissive,关闭SELINUX安全防护,但是警告
disabled,不加载SELINUX安全防护
在putty中SSH中Auth选项中添加私有秘钥文件位置
扩展内容:服务端与客户端ssh密钥对联机,无密码联机
1 )首先需要在客户端ssh-keygen生成密钥对,公钥与私钥
[root@localhost ~]# ssh-keygen
Generating public/private rsa key pair.
# 生成公共/私有密钥对
Enter file in which to save the key (/root/.ssh/id_rsa):
# 输入保存密钥文件中/root/.ssh/id_rsa
Enter passphrase (empty for no passphrase):
# 输入密码(无密码为空)
Enter same passphrase again:
# 再次确认密码
Your identification has been saved in /root/.ssh/id_rsa.
# 你的身份验证保存于/root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub.
# 你的公共密钥保存于/root/.ssh/id_rsa.pub
The key fingerprint is:
#
91:cc:42:a3:69:4b:ba:0e:7a:14:a9:dd:66:12:c5:5d [email protected]
The key's randomart p_w_picpath is:
# 随机的图像密钥为:
+--[ RSA 2048]----+
| . .o.E |
| o+.+ . |
| o= . = |
| ++ . . . |
| o.+. S |
|. +.+ |
|...+ |
|.o. |
|... |
+-----------------+
[root@localhost ~]#
2 )将公钥上传到服务端中,公钥保存在 $HOME/.ssh/id_rsa.pub
[root@localhost ~]# scp ~/.ssh/id_rsa.pub [email protected]:/tmp
[root@localhost ~]# cat ~/tmp/id_rsa.pub > ~/.ssh/authorized_keys
3 )执行下面的命令,就可以不需要密码就可以进行ssh无密码登录