System=>shut Down(關機)
Applications=>System tools=>Terminal(打指令的地方)
Applications=>System tools=>Virtual Machine Manager(開啟虛擬電腦)
ifconfig(檢查IP)
inet addr:192.168.0.116(自己ip)
ssh student@192.168.0.116(從外面連到裡面)
exit(離開)
cd ~(回家)
cd ..(上一層)
cd /(系統最外層)
ls(看有什麽資料)
pwd(看現在位置)
F12
[root@desktop12 student]# yum groupinstall chinese-support(灌中文)
[root@desktop12 student]#/usr/local/sbin/lab-resetvm(清除/備份)
mkdir test(建立目錄test)
vi aaa(更改內容)
a(後面一個位置)
i(現在位置)
o(下一行位置)
dd(刪除)
:(命令)
r(寫入)
w(儲存)
q(離開)
!(強制)
q!(強制離開)
wq(儲存離開)
cat 檔名(檢視檔案內容)
rm 檔名(移除檔案或目錄)
rm -rf 目錄(移除檔案或目錄)
touch 檔名(修改檔案時間或建置新檔)
df /(檢查硬碟資訊)
df -h(檢查硬碟資訊)
fdisk -cul /dev/vda(看硬碟)
fdisk /dev/vda(割硬碟)
p(觀察3個)
12483 cylinders(看大小)
ssh root@192.168.0.116
redhat
fdisk /dev/vda(割硬碟)
p(看硬碟情況)
n(開始割硬碟)
3(第3個區塊)
9836(p觀看上一個END位置決定數字)
+50M(看老師要求)
w(儲存)
reboot(VM重開機)
fdisk -cul /dev/vda(看有沒有出現第3個)
mkfs -t ext4 /dev/vda3(格式化)
mkdir /test(建造test目錄)
ls /(看有沒有TEST)
vi /etc/fstab
拉到最後一行
o
/dev/vda3 /test ext4 defaults 1 2
esc
:wq(儲存離開)
mount -a(沒反應就是好反應,有反應就會出錯)
reboot
fdisk /dev/vda(看82,上禮拜割的是83)(82,83,8e)(l可觀看)
p(看硬碟情況)
n(開始割硬碟)
4(第4個區塊)
9939(p觀看上一個END位置而決定數字)
+100M(看老師要求)
p(出現第4個)
t(改system id)
4(第4個區塊)
82(原本83改成82 swap,L可觀看)
w(儲存)
reboot(VM重開)
ssh root@192.168.0.116
redhat
fdisk /dev/vda
p(檢查第4個)
w(儲存退出)
vi /etc/fstab
最後一行
o
/dev/vda4 swap swap defaults 0 0
esc
:wq(儲存離開)
mkswap /dev/vda4(新增swap硬碟)
swapon -a(swap硬碟啟動)
swapon -s(swap硬碟檢查)
[root@desktop16 ~]$ :lab-setup-storage(清除硬碟)
[root@server16 ~]$ :lab-grade-storage(檢查裡面硬碟)
/test
[root@desktop16 student]#:/usr/local/sbin/lab-resetvm(清除)
fdisk /dev/vda
n
e
4
9836
+200M
n
l
5
9836
+50M
n
l
6
10242
+60M
n
l
7
10xxx
+70M
t
5
8e
t
6
8e
t
7
8e
w
reboot
pv
按TAB
pvcreate --help(看有甚麼指令可以用)
pvscan(檢查)
pvcreate /dev/vda5(加進去vda5)
pvscan(檢查)
pvcreate /dev/vda6(加進去vda6)
pvscan(檢查)
pvcreate /dev/vda7(加進去vda7)
pvdisplay(詳細觀看)
vg
按TAB
vgcreate --help(看有甚麼指令可以用)
vgcreate vg1 /dev/vda5(加進去vda5)
vgscan(檢查)
vgdisplay(檢查)
vgcreate -s 8M vg2 /dev/vda6 /dev/vda7(加進去vda6和vda7)
vgcsan(檢查)
vgdisplay(檢查)
lv
按TAB
lvcreate -n lv1 -l 4 vg1
lvscan
lvdisplay
mkfs -t ext4 /dev/vg1/lv1
mkdir /test(建造test目錄)
ls /(看有沒有TEST)
vi /etc/fstab
拉到最後一行
o
/dev/vg1/lv1 /test ext4 defaults 1 2
esc
:wq(儲存離開)
mount -a(沒反應就是好反應,有反應就會出錯)
reboot
ssh root@192.168.0.116
redhat
df -h
lab-setup-lvm(在外面清除)
ssh root@192.168.0.116
redhat
fdisk /dev/vda
p
n
p
4
9836
+600M
t
4
8e
w
reboot
ssh root@192.168.0.116
redhat
mkfs -t ext4 /dev/vda4(格式化)
pvcreate /dev/vda4
vgcreate allison /dev/vda4
lvcreate -n custdb -L 512 allison
mkfs -t ext4 /dev/allison/custdb
mkdir /test(建造test目錄)
ls /(看有沒有TEST)
vi /etc/fstab
/dev/allison/custdb /test ext4 defaults 1 2
lab-grade-lvm
mount -a
reboot
lvextend -L 700M /dev/allison/custdb(直接延伸到700M)
mount -a
resize2fs -p /dev/allison/custdb
lvextend -L +50M /dev/allison/custdb(有+號是加差距)
resize2fs -p /dev/allison/custdb
umount /test
e2fsck -f /dev/allison/custdb
resize2fs -p /dev/allison/custdb 512M
lvreduce -L 512M /dev/allison/custdb
y
mount -a
clear
showmount -e instructor.example.com
mkdir /nfstest
mount instructor:/var/ftp/pub /nfstest
ls /nfstest
reboot
ls /nfstest
cd /net/instructor/var/ftp/pub
ls /etc/auto.master
vi /etc/auto.master
(/misc /etc/auto.misc這行下面加一行)
/nfstest /etc/auto.nfstest
vi /etc/nfstest
public -ro instructor.example.com:/var/ftp/pub
service autofs restart
service autofs reload
vi /etc/auto.master
(/misc /etc/auto.misc這行下面加一行)
/server /etc/auto.server
vi /etc/auto.server
public -ro instructor.example.com:/var/nfs/oshu
cat /etc/auto.master
cat /etc/auto.server
ls /server/public
vi /etc/passwd
root:x:0:0:root:/root:/bin/bash(看第一行)
root=名字 x=密碼 0=ID nologin=???
useradd --help
useradd aaa
vi /etc/passwd
最後一行看到aaa沒密碼
exit
ssh aaa@192.168.0.116
passwd aaa(幫aaa設密碼)
aaa(自設密碼)
aaa(輸入第二次密碼)
exit
ssh aaa@192.168.0.116
輸入密碼aaa
開VM 登入student
開Terminal 登入root 再打
system-config-authentication
user Account Database:選LDAP
LDAP Search Base DN:dc=example,dc=com
Ldap Server:ldap://127.0.0.1/(改成)
Ldap Server:ldap://instrustor.example.com/
Use TLS to encrypt connections (打勾)
Download CA Certificate (點開)
打網址
http://instrustor.example.com/pub/EXAMPLE-CA-CERT
Authentication Method:選擇LDAP password
getent passwd ldapuser1(最後一個是一不是L)
外
[root@server12 student]# vi /etc/auto.master
/home/guests /etc/auto.ldapuser12
[root@server12 student]# vi /etc/auto.ldapuser12
ldapuser12 -rw instructor.example.com:/home/guests/ldapuser12
* -rw instructor.example.com:/home/guests/& (萬用字元)
[root@server12 student]# service autofs stop
[root@server12 student]# service autofs start
[root@server12 student]# su ldapuser12
[ldapuser12@server12 student]$ cd ~
[ldapuser12@server12 ~]$ pwd
[student@desktop12 ~]$ ssh -X root@192.168.0.112
[root@server12 ~]# system-config-authentication
學號:9879503 姓名:蔡博文
useradd abc
id abc
groupadd -g 1000 csie
groupadd -g 1001 cc
cat /etc/group
id abc def
id def
id def
useradd def
useradd csie
useradd cc
cat /etc/group
usermod -G csie abc
id abc
usermod -G cc def
id def
groupadd -g 1002 dahan
usermod -G abc dahan
id abc
usermod -aG dahan abc
id abc
usermod -aG cc abc
usermod -aG csie abc
id abc
su abc
su - abc
[root@server12 student]# cat /etc/passwd
[root@server12 test]# chown root.dahan /test
[root@server12 test]# chmod 775 /test
useradd usera
useradd userb
useradd userc
useradd userd
groupadd -g 1003 ga
groupadd -g 1004 gb
groupadd -g 1005 gall
usermod -aG ga usera
usermod -aG gall usera
usermod -aG ga userb
usermod -aG gall userb
usermod -aG gb userc
usermod -aG gall userc
usermod -aG gb userd
usermod -aG gall userd
cd /test
mkdir testa
mkdir testb
chmod 750 testa
chmod 750 testb
setfacl -m g:ga:rwx testa/
setfacl -m g:gb:rx testa/
setfacl -m u:userd:--- testa/
setfacl -m g:gall:rwx testb/
setfacl -m u:usera:--- testb/
[root@server12 test]# cd /etc
[root@server12 etc]# cd /etc/yum.repos.d/
[root@server12 yum.repos.d]# vi updates.repo
-------------------------------------------------
[updates]
name=red hat update
baseurl=ftp://instructor.example.com/pub/rhel6/Errata
enabled=1
gpgcheck=0
http://instructor.example.com/pub/rhel6/Errata/rhel-x86_64-server-6/網址
uname -r 檢查版本
wget 網址
kernel-firmware-2.6.32-71.7.1.el6.noarch.rpm 先安裝
kernel-2.6.32-71.7.1.el6.x86_64.rpm
rpm -ivh 網址
reboot
uname -r 檢查版本
rpm -qa vsftpd
rpm -qa httpd
service httpd start
service vsftpd start
網頁打IP 192.168.0.XXX 啟動
cd /var/www/html/
vi test.html
班級:電通四A
學號:9879503
姓名:蔡博文
網頁打IP 192.168.0.XXX/test.html
chkconfig --list sshd 開機執行級層
chkconfig httpd on 開機後自動起來
chkconfig vsftpd on 開機後自動起來
ps aux|grep httpd 查尋
ps aux|grep vsftpd 查尋
crontab -e
1 0-1/1 * * * echo "run 23 minutes after midn, 2am, 4am ..., everyday"
************************************
開啟VM 任ㄧ鍵 選下面第2個 按A
sXXX空格s
setenforce 0
passwd
1234
reboot
************************************
system-config-network
************************************
system-config-date
************************************
1.
----------------------------------
[root@server12 student]# cd /
[root@server12 /]# mkdir salary
[root@server12 /]# mkdir publication
chmod 770 salary
chmod 770 publication
[root@server12 student]# useradd Mike
[root@server12 student]# useradd Jorge
[root@server12 student]# useradd Jash
[root@server12 student]# useradd Sofia
[root@server12 student]# useradd Jennifer
[root@server12 student]# useradd David
[root@server12 student]# useradd John
[root@server12 student]# useradd Josef
[root@server12 student]# groupadd -g 1000 human
[root@server12 student]# groupadd -g 1001 account
[root@server12 student]# groupadd -g 1002 general
[root@server12 student]# usermod -aG human Mike
[root@server12 student]# usermod -aG human Jorge
[root@server12 student]# usermod -aG human Jash
[root@server12 student]# usermod -aG account Sofia
[root@server12 student]# usermod -aG account Jennifer
[root@server12 student]# usermod -aG general David
[root@server12 student]# usermod -aG general John
[root@server12 student]# usermod -aG general Josef
[root@server12 student]# cd /
[root@server12 /]# setfacl -m g:account:rwx salary
[root@server12 /]# setfacl -m g:human:rx salary
[root@server12 /]# setfacl -m g:general:--- salary
[root@server12 /]# setfacl -m u:Jennifer:rx salary
[root@server12 /]# setfacl -m u:Mike:rwx salary
[root@server12 /]# setfacl -m u:David:rx salary/
[root@server12 /]# setfacl -m g:human:rx publication
[root@server12 /]# setfacl -m g:account:rx publication
[root@server12 /]# setfacl -m g:general:rx publication
[root@server12 /]# setfacl -m u:David:rwx publication
[root@server12 /]# getfacl salary
[root@server12 /]# getfacl publication
[root@server12 /]# passwd Mike
再開一個Terminal
[Mike@server12 ~]$ cd /home/Mike
[Mike@server12 ~]$ mkdir Mikeproject
[Mike@server12 ~]$ ls
[Mike@server12 ~]$ setfacl -m u:Smith:rwx Mikeproject/
[Mike@server12 ~]$ setfacl -m u:Johnson:rwx Mikeproject/
[Mike@server12 ~]$ getfacl Mikeproject/
-----------------------------------------------
2.
---------------------------
http://instructor.example.com/pub/rhel6/Errata/rhel-x86_64-server-6/網址
wget kernel-firmware-2.6.32-71.7.1.el6.noarch.rpm 先安裝
wget kernel-2.6.32-71.7.1.el6.x86_64.rpm
rpm -ivh kernel-firmware-2.6.32-71.7.1.el6.noarch.rpm
rpm -ivh kernel-2.6.32-71.7.1.el6.x86_64.rpm
reboot
----------------------------------------------
3.
------------------------------------------------
rpm -qa vsftpd
rpm -qa httpd
service httpd start
service vsftpd start
網頁打IP 192.168.0.XXX 啟動
cd /var/www/html/
vi test.html
班級:電通四A
學號:9879503
姓名:蔡博文
網頁打IP 192.168.0.XXX/test.html
chkconfig --list sshd 開機執行級層
chkconfig httpd on 開機後自動起來
chkconfig vsftpd on 開機後自動起來
ps aux|grep httpd 查尋
ps aux|grep vsftpd 查尋
--------------------------------------------------
4.
-----------------------
[root@server12 test]# cd /etc
[root@server12 etc]# cd /etc/yum.repos.d/
[root@server12 yum.repos.d]# vi updates.repo
-------------------------------------------------
[updates]
name=red hat update
baseurl=ftp://instructor.example.com/pub/rhel6/Errata
enabled=1
gpgcheck=0
--------------------
[root@server12 /]#yum update
--------------------------
5.
---------------------------------
crontab -u root -e
分 時 日 月 周(*=任意 8-12=8至12 */5=每隔5 )
*/1 * * * * echo 要的字
cat /var/spool/mail/root