RHEL7的救援模式,相当于RHEL6的单用户模式。
要在不知道root密码的前提下修改root密码,进入救援模式最靠谱。
参考文档
How To Reset Your Forgotten Root Password On CentOS 7 Servers
步骤
1. 进入Grub后修改启动选项。(按e可以编辑)
2. 在linux那一栏,加上
init=/sysroot/bin/sh
3. 删除
rhgb quiet
Linux, RHEL, CentOS, etc.
RHEL7的救援模式,相当于RHEL6的单用户模式。
要在不知道root密码的前提下修改root密码,进入救援模式最靠谱。
How To Reset Your Forgotten Root Password On CentOS 7 Servers
1. 进入Grub后修改启动选项。(按e可以编辑)
2. 在linux那一栏,加上
init=/sysroot/bin/sh
3. 删除
rhgb quiet
Postfix 可用作Mail Server, 它配置起来要比Sendmail简单得多。
1. 鸟哥Mail server http://linux.vbird.org/linux_server/0380mail.php
2. Postfix官方文档 http://www.postfix.org/documentation.html
3. 鸟哥DNS server http://linux.vbird.org/linux_server/0350dns.php
3台虚拟机,操作系统为CentOS 6.5;
Host1的IP是192.168.56.101, Host2的IP是192.168.56.102,Host2的IP是192.168.56.103;
1. Host1与Host2互相收发邮件;
2. 用Telnet发邮件;
3. 邮件Relay;
4. Virtual Alias Domain;
5. Virtual Mailbox Domain;
6. SASL认证;
7. Dovecot.
FTP是最经典的网络服务(之一),就是用来传文件啦。
暑假的时候一同学在Win7上折腾了半天FTP没搞成(估计是防火墙?),而在Linux上整个FTP Server是件很轻松的事情。
推荐使用vsftpd作为FTP server,因为它Very Secure,关键是简单易用。
1. 鸟哥Linux私房菜-FTP http://linux.vbird.org/linux_server/0410vsftpd.php
2. vsftpd文档 https://security.appspot.com/vsftpd/vsftpd_conf.html
3. Redhat Document FTP and SELinux https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Managing_Confined_Services/chap-Managing_Confined_Services-File_Transfer_Protocol.html
1. Server和Client操作系统均为RHEL6.5;
2. Server机的IP地址是192.168.122.30;
3. Client机的IP地址是192.168.122.92;
在Server端,安装vsftpd.
[root@localhost ~]# yum install vsftpd
在Client端,安装ftp.(还有很多ftp client可以选择~)
[root@main ~]# yum install ftp
1.鸟哥的Linux私房菜-DNS Server: http://linux.vbird.org/linux_server/0350dns.php
2.BIND-Documentation: https://kb.isc.org/article/AA-01031
3.RFC 1035 http://tools.ietf.org/html/rfc1035
4.RFC 1034 http://tools.ietf.org/html/rfc1034
[root@server1 ~]# yum install bind bind-chroot bind-utils
Bind的配置文件在/etc/named.conf和/var/named/中。
(更多…)
存储涉及好多好多东西,这里把软RAID,iSCSI,Multipath,LVM,SWAP都堆在一起,做个简单的综合实验。
参考文档已经说明的东西,这里就不重复讲述了。
1. 鸟哥的Linxu私房菜-LVM,Storage http://linux.vbird.org/linux_basic/0420quota.php
2. 鸟哥的Linxu私房菜-iSCSI http://linux.vbird.org/linux_server/0460iscsi.php
3. Redhat iSCSI文档 https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/ch-iscsi.html
4. Redhat Multipath文档 https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html-single/DM_Multipath/
5. Redhat LVM文档 https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Logical_Volume_Manager_Administration/
1.鸟哥的Linux私房菜 http://linux.vbird.org/linux_server/0420squid.php
2.Squid文档 http://www.squid-cache.org/Versions/v3/3.1/cfgman/
3.https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Managing_Confined_Services/chap-Managing_Confined_Services-Squid_Caching_Proxy.html
1. 物理机和虚拟机的操作系统为 RHEL6.5;物理机IP地址为192.168.122.1,虚拟机IP地址为192.168.122.108
2. 虚拟机作为squid server,物理机作为client;
3. 实验配置虚拟机为标准代理,让物理机可以通过代理浏览网页;
4. 配置squid,使得baidu不能被访问;
5. 将虚拟机配置成透明代理;
配置/etc/sysctl.conf,修改ipforward为1,启用物理机的路由功能。
# Controls IP packet forwarding net.ipv4.ip_forward = 1
更新kernel参数
[root@feichashao ~]# sysctl -p
确认虚拟机能连上外网。
ping -c3 www.baidu.com
Apache httpd是应用最广的http服务器,它的基本安装配置也很简单。
1. httpd配置文档 http://httpd.apache.org/docs/2.2/configuring.html
2. 文档路径 http://httpd.apache.org/docs/2.2/urlmapping.html
3. 认证授权 http://httpd.apache.org/docs/2.2/howto/auth.html
4. 虚拟主机 http://httpd.apache.org/docs/2.2/vhosts/
5. 访问控制 http://httpd.apache.org/docs/2.2/howto/access.html
6. 鸟哥私房菜 http://linux.vbird.org/linux_server/0360apache.php
在虚拟机上搭建服务器,用物理机来访问;
1. 虚拟机和物理机均使用RHEL 6.5;
2. 虚拟机安装Apache HTTPD 2.2;
3. 虚拟机IP 192.168.122.108;
4. 物理机IP 192.168.122.1;
RHEL6.5的镜像自带了Apache httpd,推荐使用它。
[cc lang=”text”]
[root@server1 ~]# yum install httpd -y
[/cc]
完事了。
[cc lang=”text”]# vim /etc/sysconfig/iptables
-A INPUT -p TCP –dport 80 -j ACCEPT # 在Reject的条目前加上这一行
# /etc/init.d/iptables restart
[/cc]
[cc lang=”text”]
# setsebool -P httpd_can_network_connect=1
[/cc]
如果httpd的资料目录不是/var/www/html,那么需要修改该目录的selinux context.
[cc lang=”text”]
chcon -reference /var/www/html /httpd
[/cc]
无需修改配置,直接启动httpd,即可访问。
[cc lang=”text”]
[root@server1 ~]# /etc/init.d/httpd restart
[/cc]
在物理机上,在浏览器上输入虚拟机的IP地址192.168.122.108,即可看到测试页面。
要更改网页的内容,直接修改DocumentRoot目录下(/var/www/html)的内容即可。
在/var/www/html/下建立一个index.html文件.
[cc lang=”text”]
# vim /var/www/html/index.html
Hello World.
[/cc]
保存。
在物理机的浏览器上刷新一下页面,就能看到Hello World!字样啦。
(更多…)
本文记下常用的bash shell语法和命令,方便日后参考。
Bash Guide for Beginners
http://www.tldp.org/LDP/Bash-Beginners-Guide/html/
1. bash脚本要以
#!/bin/bash
开头。
2. ‘#’号后面的都是注释,如
# An example for bash comment. echo "hehe" # Print hehe to screen.
通过bonding,可以将两块或多块网卡当作一块网卡使用,可用于提高性能或是冗余。
# yum install kernel-doc # vim /usr/share/doc/kernel-doc-2.6.32/Documentation/networking/bonding.txt
用VNC可以以桌面的方式,连接到远程电脑进行操作。
下面描述如何对VNC Server和VNC Client进行配置。
VNC Server即要远程连到的电脑。
1. 安装tigervnc-server
# yum install tigervnc-server
2. 设置VNC密码
# vncpasswd
执行这条命令的用户就是vnc的用户名;
输入两次密码就设置成功了。
3. 修改vncviewer配置文件
# vim /etc/sysconfig/vncservers
里面加上两行
VNCSERVERS="2:root" VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp"
2是Display号,root是用户。
4. 开放防火墙5900-6000端口,重启vncserver
# /etc/init.d/vncserver restart