1.NFS
(1)安装
安装以下包及依赖包
[root@instructor Packages]# find nfs*
nfs4-acl-tools-0.3.3-5.el6.x86_64.rpm
nfs-utils-1.2.2-7.el6.x86_64.rpm
nfs-utils-lib-1.1.5-1.el6.i686.rpm
nfs-utils-lib-1.1.5-1.el6.x86_64.rpm
 
(2)开启服务
[root@instructor Packages]# chkconfig --list nfs
nfs             0:off   1:off   2:off   3:off   4:off   5:off   6:off
[root@instructor Packages]# chkconfig nfs on
[root@instructor Packages]# chkconfig --list nfs
nfs             0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@instructor Packages]# chkconfig --level 5 nfs off
[root@instructor Packages]# chkconfig --list nfs
nfs             0:off   1:off   2:on    3:on    4:on    5:off   6:off
[root@instructor Packages]# chkconfig --level 5 nfs on
[root@instructor Packages]# chkconfig --list nfs
nfs             0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@instructor Packages]#
 
(3)安装端口映射服务,启动portreserve
[root@instructor Packages]# find rpcbind-0.2.0-8.el6.x86_64.rpm
#红帽6.0前叫PORTMAP
rpcbind-0.2.0-8.el6.x86_64.rpm
[root@instructor Packages]# rpm -ivh rpcbind-0.2.0-8.el6.x86_64.rpm
warning: rpcbind-0.2.0-8.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
        package rpcbind-0.2.0-8.el6.x86_64 is already installed
[root@instructor Packages]# find portreserve
find: `portreserve': No such file or directory
[root@instructor Packages]# find portreserve*
portreserve-0.0.4-4.el6.x86_64.rpm
#-------------------------------------------------------6.3不用安装以下步骤
[root@instructor Packages]# rpm -ivh portreserve-0.0.4-4.el6.x86_64.rpm
warning: portreserve-0.0.4-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:portreserve            ########################################### [100%]
#-------------------------------------------------------------------------------------------
[root@h1 ~]# /etc/init.d/portreserve start
正在启动 portreserve:
[root@h1 ~]# service portreserve status
portreserve (pid  1391) 正在运行...
[root@h1 ~]#
 
[root@h1 var]# cd ..
[root@h1 /]# mkdir /var/share
[root@h1 /]# cd /var/share
[root@h1 share]# vi 1.txt
Hello World!
~
"1.txt" [New] 1L, 13C written
 

[root@h1 share]# vi /etc/exports
/var/share  *(rw,sync)
~
"/etc/exports" 1L, 23C written
p_w_picpath
[root@h1 share]# service nfs restart
关闭 NFS 守护进程:[确定]
关闭 NFS mountd:[确定]
关闭 NFS quotas:[确定]
关闭 NFS 服务: [确定]
启动 NFS 服务: [确定]
关掉 NFS 配额:[确定]
启动 NFS mountd:[确定]
正在启动 RPC idmapd:[确定]
正在启动 RPC idmapd:[确定]
启动 NFS 守护进程:[确定]

[root@h1 share]#
 
关防火墙
[root@h1 ~]# export display=192.168.8.21:0.0
[root@h1 ~]# export lang=""
[root@h1 ~]# setup
p_w_picpath
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled#enforcing
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
~
#[root@h1 ~]# init 6
#----------------重启
 
[root@h1 ~]# service iptables stop
[root@h1 var]# service nfs start
[root@h1 var]# service portreserve start
正在启动 portreserve:
[root@h1 var]#
[root@h1 ~]# showmount  -e 192.168.8.100
Export list for 192.168.8.100:
/user1 *
[root@h1 ~]# mkdir /var/mount/100
mkdir: 无法创建目录"/var/mount/100": 没有那个文件或目录
[root@h1 ~]# mkdir -p /var/mount/100
[root@h1 ~]# mount 192.168.8.100:/user1 /var/mount/100
[root@h1 ~]# cd /var/mount/100
[root@h1 100]# ls
000.txt  123.txt  222.txt
[root@h1 100]# touch 192.168.8.20.txt
[root@h1 100]# vi 192.168.8.20.txt
Hello!
~
"192.168.8.20.txt" 2L, 8C written
#-------------------以下文件同步
[root@h1 share]# cd /var/mount/100/
[root@h1 100]# ls
000.txt  123.txt  192.168.8.20.txt  222.txt
[root@h1 100]# ll -a
总用量 24
drwxrwxrwx 4 root      root      4096 11月 11 2012 .
drwxr-xr-x 3 root      root      4096 11月 11 11:41 ..
drwxr-xr-x 2 nfsnobody nfsnobody 4096 11月 11 2012 000.txt
-rw-r--r-- 1 nfsnobody nfsnobody    7 11月 11 2012 123.txt
-rw-r--r-- 1 nfsnobody nfsnobody    8 11月 11 2012 192.168.8.20.txt
drwxr-xr-x 2 nfsnobody nfsnobody 4096 11月 11 2012 222.txt
#----------------------------------------------
[root@h1 100]#chmod 777 /var/share
#----------------权限变更后,vsdtpd重启
[root@h1 100]#service vsftpd restart
#----------NFS服务器双网卡
#-----ip1 192.168.8.20
#-----ip2 192.168.5.130
在client 192.168.5.128上

Last login: Sat Nov 10 20:30:50 2012 from 192.168.5.222
[root@instructor ~]# showmount -e 192.168.5.130
Export list for 192.168.5.130:
/var/share *
[root@instructor mount]# umount /var/mount/130
[root@instructor mount]# rmdir 130
[root@instructor mount]# mkdir -p /var/mount/130
[root@instructor mount]# mount 192.168.5.130:/var/share /var/mount/130/
[root@instructor mount]# cd 130
[root@instructor 130]# ls
1.txt
[root@instructor 130]# cp 1.txt 2.txt
[root@instructor 130]#
[root@instructor mount]# umount /var/mount/130
2.vsdtpd(ftp服务)
(1)
[root@h1 /]# yum install vsftp
[root@h1 /]# service vsftpd start
为 vsftpd 启动 vsftpd:[确定]
 
(2)允许root登陆
[root@h1 /]# vi /etc/vsftpd/ftpusers
# Users that are not allowed to login via ftp
#root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody
~
"/etc/vsftpd/ftpusers" 15L, 126C written
[root@h1 /]#
----------------------------------------------------------
[root@h1 /]# vi /etc/vsftpd/user_list
# vsftpd userlist
# If userlist_deny=NO, only allow users in this file
# If userlist_deny=YES (default), never allow users in this file, and
# do not even prompt for a password.
# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
# for users that are denied.
#root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody
~
"/etc/vsftpd/user_list" 20L, 362C written
[root@h1 /]#
#---------------关闭iptables和selinux
dos下运行
C:\Users\陈\Desktop>ftp 192.168.5.130
连接到 192.168.5.130。
220 (vsFTPd 2.2.2)
用户(192.168.5.130:(none)): root
331 Please specify the password.
密码:
230 Login successful.
ftp> dir
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-------    1 0        0            1726 Oct 19 22:39 anaconda-ks.cfg
-rw-r--r--    1 0        0           48953 Oct 19 22:39 install.log
-rw-r--r--    1 0        0           12572 Oct 19 22:38 install.log.syslog
drwxr-xr-x    2 0        0            4096 Oct 19 22:45 涓嬭浇
drwxr-xr-x    2 0        0            4096 Oct 19 22:45 鍏叡鐨?
drwxr-xr-x    2 0        0            4096 Oct 19 22:45 鍥剧墖
drwxr-xr-x    2 0        0            4096 Oct 19 22:45 鏂囨。
drwxr-xr-x    2 0        0            4096 Oct 19 22:45 妗岄潰
drwxr-xr-x    2 0        0            4096 Oct 19 22:45 妯℃澘
drwxr-xr-x    2 0        0            4096 Oct 19 22:45 瑙嗛
drwxr-xr-x    2 0        0            4096 Oct 19 22:45 闊充箰
226 Directory send OK.
ftp: 收到 733 字节,用时 0.02秒 45.81千字节/秒。
ftp> cd /var/ftp/pub/
250 Directory successfully changed.
ftp> put temp/txt
temp/txt: ftp>
ftp> put temp.txt
200 PORT command successful. Consider using PASV.
150 Ok to send data.
226 Transfer complete.
ftp: 发送 1030 字节,用时 0.00秒 1030000.00千字节/秒。
(3)匿名登陆
#-------------允许匿名登陆
[root@h1 pub]# vi /etc/vsftpd/vsftpd.conf
25 # has an effect if the above global write enable is activated. Also, you will
26 # obviously need to create a directory writable by the FTP user.
27 anon_upload_enable=YES
28 #
29 # Uncomment this if you want the anonymous FTP user to be able to create
30 # new directories.
31 anon_mkdir_write_enable=YES
32 #
"/etc/vsftpd/vsftpd.conf" 119L, 4597C written
[root@h1 pub]# service vsftpd restart
关闭 vsftpd:[确定]
为 vsftpd 启动 vsftpd:[确定]
[root@h1 pub]#
#-----------dos下运行
#---------匿名用户是ftp,密码ftp
 
 
3.磁盘
[root@h1 ~]# df -hT
文件系统    类型      容量  已用  可用 已用%% 挂载点
/dev/sda2     ext4     70G   19G   47G  29% /
tmpfs        tmpfs    940M  264K  940M   1% /dev/shm
[root@h1 ~]# fdisk -l
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sda: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0003ea61
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1        1275    10240000   82  Linux swap / Solaris
/dev/sda2   *        1275       10444    73645056   83  Linux

[root@h1 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x7a268102.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1): 1^H
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): 500M
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
#--------------------分区生效
[root@h1 ~]# partprobe
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (设备或资源忙).  As a result, it may not reflect all of your changes until after reboot.
[root@h1 ~]#
 
[root@h1 ~]# fdisk -l
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x7a268102
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         500     4016218+  83  Linux
#----------------未格式化,裸设备
Disk /dev/sda: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0003ea61
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1        1275    10240000   82  Linux swap / Solaris
/dev/sda2   *        1275       10444    73645056   83  Linux
[root@h1 ~]#
#--------------------格式化
[root@h1 ~]# mkfs.ext3 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe blocks
251472 inodes, 1004054 blocks
50202 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=1031798784
31 block groups
32768 blocks per group, 32768 fragments per group
8112 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736
正在写入inode表: 完成                           
Creating journal (16384 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
-------------------磁盘挂载
[root@h1 ~]# fdisk -l
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x7a268102
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         500     4016218+  83  Linux
Disk /dev/sda: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0003ea61
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1        1275    10240000   82  Linux swap / Solaris
/dev/sda2   *        1275       10444    73645056   83  Linux
[root@h1 ~]# mount /dev/sdb1 /var/share/
[root@h1 ~]# df -hT
文件系统    类型      容量  已用  可用 已用%% 挂载点
/dev/sda2     ext4     70G   19G   47G  29% /
tmpfs        tmpfs    940M  264K  940M   1% /dev/shm
/dev/sdb1     ext3    3.8G   72M  3.6G   2% /var/share
[root@h1 ~]#
 
 
4.httpd (apache)
[root@h1 ~]# yum install httpd
[root@h1 ~]# service httpd start
正在启动 httpd:httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.5.130 for ServerName
[确定]
[root@h1 html]# pwd
/var/www/html#--------------网页页面目录
[root@h1 html]# vi hello.html
<html>
<body>
<title>
HELLO !
</title>
"HELLO EVERYONE!"
</body>
</html>
~

"hello.html" 9L, 74C written
[root@h1 html]#
p_w_picpath
 
 
5.安装MYSQL
(1)安装
perl-DBD-mySQL
mysql-server
(2)重启
[root@h1 html]# service mysqld restart
停止 mysqld: [确定]
初始化 MySQL 数据库: Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h h1 password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
[确定]
正在启动 mysqld: [确定]
[root@h1 html]#
[root@h1 html]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.61 Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql                |
| test                    |
+--------------------+
3 rows in set (0.00 s ec)
mysql> create database db1;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| db1                 |
| mysql             |
| test                 |
+--------------------+
4 rows in set (0.00 sec)
mysql> use db1;
Database changed
mysql> create table t1(id int,name varchar(30));
Query OK, 0 rows affected (0.01 sec)

mysql> insert into t1 values(1,'ORACLE');
Query OK, 1 row affected (0.00 sec)
mysql> insert into t1 values(2,'RedHat');
Query OK, 1 row affected (0.00 sec)
mysql> select * from t1;
+------+--------+
| id   | name   |
+------+--------+
|    1 | ORACLE |
|    2 | RedHat |
+------+--------+
2 rows in set (0.00 sec)
mysql>
mysql> use mysql ;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| event                     |
| func                      |
| general_log               |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| host                      |
| ndb_binlog_index          |
| plugin                    |
| proc                      |
| procs_priv                |
| servers                   |
| slow_log                  |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
+---------------------------+
23 rows in set (0.00 sec)

mysql> use mysql ;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| event                     |
| func                      |
| general_log               |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| host                      |
| ndb_binlog_index          |
| plugin                    |
| proc                      |
| procs_priv                |
| servers                   |
| slow_log                  |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
+---------------------------+
23 rows in set (0.00 sec)
mysql> select host,user,password from user;
+-----------+------+----------+
| host      | user | password |
+-----------+------+----------+
| localhost | root |          |
| h1        | root |          |
| 127.0.0.1 | root |          |
| localhost |      |          |
| h1        |      |          |
+-----------+------+----------+
5 rows in set (0.00 sec)
mysql> quit
Bye
[root@h1 html]# vi 1.sql
use db1
create table t00(id int,name varchar(30));
insert into t00 values(1,'ORACLE');
insert into t00 values(2,'MYSQL');
"1.sql" [New] 5L, 123C written
[root@h1 html]#
[root@h1 html]# mysql
mysql> source /var/www/html/1.sql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
Query OK, 0 rows affected (0.03 sec)
Query OK, 1 row affected (0.02 sec)
Query OK, 1 row affected (0.00 sec)
mysql>