linux笔记 乱七八糟

虚拟化:
    现有的硬件模拟出多个硬件设备(逻辑)
云计算:
条件:
[root@localhost 桌面]# cat /proc/cpuinfo

半虚拟化:openVZ Xen
完全虚拟化:KVM workstation
intel:vmx
Amd:svm

[root@localhost 桌面]# cat /proc/cpuinfo | grep flags | tail -n 1 | grep --color vmx

yum-config-manager | grep --color gpgcheck

yum install ip*

rh318

[root@localhost yum.repos.d]# yum grouplist
[root@localhost yum.repos.d]# yum groupinstall 虚拟化*
/etc/init.d/libvirtd 检查
/etc/init.d/libvirtd status
/etc/init.d/libvirtd start   出现错误 启动守护进程

find / -name "virt*"

ls -ld /etc/rc.d

virsh list --all 查看所有虚拟机

[root@localhost yum.repos.d]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# cp ifcfg-eth0 ifcfg-eth0.bak

/etc/init.d/network restart

brctl show

[root@localhost 桌面]# pvcreate /dev/sda4
  Physical volume "/dev/sda4" successfully created
[root@localhost 桌面]# vgcreate vg00 /dev/sda4
  Volume group "vg00" successfully created
[root@localhost 桌面]# vgdisplay

vim /etc/host
192.168.2.1  station1.example.com
192.168.2.17 station17.example.com

ssh 192.168.2.17

man 5 init
启动流程:
Upstart:事件
mbr:
|---------------------------------------
|446(mbr) | 64(分区表) = 16*4 | 55aa
|---------------------------------------

446==grub (启动引导程序)

cd /boot/grub
grub.conf

[]#hexdump -C stage1    16进制表示

dd if=/dev/sda of=mbr.bak bs=512 count=1
救援模式:grub-install
(再生龙)

 
rhgb : 启动 以图形显示
quiet: 不显示kernel加载的详细信息
cat /proc/cmdline

chmod 777 *
rpm -ivh kernel-de

default=0
timeout=15
splashimage=(hd0,0)/grub/splash.xpm.gz
#hiddenmenu
title Red Hat Enterprise Linux Server (2.6.32-131.0.15.el6.x86_64.debug)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-131.0.15.el6.x86_64.debug ro root=UUID=87cdb2bf-0a65-4bcf-80e5-66b1becda0e6 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=zh_CN.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto crashkernel=auto quiet
        initrd /initramfs-2.6.32-131.0.15.el6.x86_64.debug.img
title Red Hat Enterprise Linux (2.6.32-131.0.15.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-131.0.15.el6.x86_64 ro root=UUID=87cdb2bf-0a65-4bcf-80e5-66b1becda0e6 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=zh_CN.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto crashkernel=auto rhgb quiet
        initrd /initramfs-2.6.32-131.0.15.el6.x86_64.img

chroot /mnt/sysimage
ifconfig eth0 192.168.2.19  临时IP地址

initrd /initramfs-2.6.32-131.*********

---------------------------------------------------
inittab 进程 文件
/etc/inittab  ---> /etc/init: --->login == root
启动模式:

无密码状态下进入系统:
按下e
按下e
输入 空格 single
按下b

id    : 5   : initdefault :
自定义 :3,5: 选项         :动作

[root@station198 桌面]# virt-manager
------------------------------------------------------------
[root@station198 etc]# cd yum.repos.d
[root@station198 yum.repos.d]# ls
redhat.repo  rhel-source.repo
[root@station198 yum.repos.d]# cat rhel-source.repo

/etc/sysconfig/network-script
/etc/init.d/network restart
------------------------------------------------------------

服务基本:
apache suqid vsftpd samba nfs mail=postfix dns dhcp xinetd
域名访问:

iptables + selinux ----------> 开启

dns:域名解析
/etc/hosts  ip地址<---->主机名

----------------------------
bind(普通文件)       mydns(mysql)
----------------------------

顶级域名    .(root) 13台
-------------------------------------------
     |       |             |           |
一级域名    com      cn           org         net

www.163.com  (FQDN)完整域名 192.168.2.1
192.168.2.1 & 255.255.255.0 = 192.168.2.

主机名:1
域名:192.168.2.

vim /etc/sysconfig/network
vim /etc/rc.local
[root@station198 etc]# ssh 192.168.2.17
[root@station198 etc]# yum --enablerepo=rhel install bind*
[root@station198 etc]# rpm -qa bind
[root@station198 etc]# rpm -qa |grep bind
[root@station198 etc]# rpm -ql bind
[root@station198 etc]# etc/init.d/named start/restart

[root@station198 etc]# ls /etc/named

chroot ----/var/named/chroot/etc/named.conf  == /

etc目录 var目录
etc    var/named
-----------------------------------------
named.conf

服务器主配:
zone "163.com" IN {
    type hint;       
    file "named.ca"; /var/named/chroot/var/named/named.ca
}
/var/named/chroot/var/named/named.ca
ip    hostname
www   

zone "." IN {
    type hint; hint/master/      
    file "named.ca"; /var/named/chroot/var/named/named.ca
};

named.conf 路径 ll

www.163.com
封包==
    |---------------------------
    |dnsip 53(虚拟端口)
    |本机ip
    |www.163.com
    |---------------------------

/etc/yum.repos.d/kk.repo
[rhel-server]
name=rhel6cp
baseurl=ftp://192.168.2.1/rpm/rhel6/Server
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[root@station198 etc]# man 5 named.conf
type master;
file "example197.com.zone";var

include "/etc/example197.com.zones"; /var/named/chroot/etc/example197.com.zones

touch example197.com.zones

chown root.named example197.com.zones
cp named.conf named.conf.v1
/etc/init.d/named restart
touch example197.com.zones
cp -a /etc/named.conf named.conf   --------- var/named
rm file

cd var/named
cp -a named.localhost example197.com

/var/named/chroot/var/named example17.com.zone
/var/named/chroot/etc/named.conf

cp -a /var/named/named.localhost /var/named/chroot/var/named/

查看错误日志:tail -f /var/log/messages
切根目录:cat /etc/sysconfig/named
 
dns 指向自己
host www.example17.com
iptables -L
vim named.conf

linster any;
localhost:any;

cd /etc/sysconfig/network-sc
vim ifcfg-eth0
virt-manager
DNS1=192.168.2.17

/etc/init.d/named restart

/etc/init.d/network restart

nslookup

/var/named/chroot/etc

zone "2.168.192.in-addr.arpa" IN {
    type master;
    file "192.168.2.0.example17.com.zone";
};

cp -a example197.com.zone 192.168.2.0.example197.com.zone

17 PTR station197.example197.com.
17 PTR www.example197.com.
17 PTR www1.example197.com.
18 PTR www2.example197.com.

cd /var/www/html
touch index.html
echo '<h1>station197.example197.com<h1>' > index.html
/etc/init.d/httpd start

11.27
[root@station198 桌面]# /etc/init.d/iptables status
[root@station198 桌面]# /etc/init.d/iptables stop

mail:postfix sendmail
dns + MS 记录

邮件服务器:25端口 + smtp 协议 上传
客户端:pop3 + 110 回传

DNS:
[root@station198 桌面]# /etc/init.d/named restart
[root@station198 桌面]# /etc/init.d/named status
[root@station198 桌面]# cd /var/named/chroot/var/named/

邮件存放位置:/var/spool/mail/uplook
dig -t MX example30.com

vim /var/named/chroot/etc/named.conf

example17.com.zone

lsof -i :25
ps -aux | grep 1699
netstat -tunalp | grep :25

[root@station198 桌面]# rpm -aq |grep postfix
cd /etc/

:set nu 开启行号

/etc/init.d/postfix restart

useradd station197
passwd station197
su - station197

[root@station198 桌面]# mail [email protected]

空行 ctl+d

[root@station198 桌面]#grep -v "#" /etc/postfix/main.cf | grep -v "^$"
postqueue -p
postqueue -f 清除

netstat -tunapl | grep pop3
netstat -tunapl | grep 110

/etc/init.d/dovecot start
cd /etc/dovecot
vim dovecot.conf

8337797

netstat -tunapl | grep pop3
[root@station197 ~]# cd /etc/dovecot/conf.d
[root@station197 conf.d]# vim 10-mail.conf

[root@station197 mnt]# cd /var/www/html
[root@station197 html]# mv squirrelmail-1.4.22 mail
[root@station197 html]# pwd
/var/www/html

mkdir -p /var/local/squirrelmail/data
chown -R apache:apache /var/local/squirrelmail/data

[root@station197 html]#useradd station172 -s /sbin/nologin
[root@station197 html]#vim /etc/aliases
[root@station197 html]#newaliases

文件传输:ftp samba:安全  nfs:配置
-----------------------------------
ftp:vsftp:安全 purftp:功能
-----------------------------------

1.ftp 用户:匿名 普通 虚拟
2.安全:tcpwarrp 用户分离(黑白) 独立日志
3.性能:rate
man 5 vsftpd.conf

rpm -qa | grep vsftp

vsftpd:192.168.2.0/24
sftpd:192.168.2.0/24

vim /etc/hosts.allow
vsftpd:192.168.2.0/24

vim /etc/hosts.deny

cd /var/ftp

cd /usr/share/doc/vsftpd-2.2.2/

cp vsftpd.pam /etc/pam.d/ftp

特权用户 vip:123456  pub:123456  在vsftpd.conf中 映射成真是的用户
1.生成:*.db
2.验证模块:pam
3.vsftpd.conf

cd /etc/vsftpd

pam.d目录下 vsftpd

你可能感兴趣的:(apache,html,linux,vim,虚拟化,邮件服务器)