在 CentOS 7.x 上使用 vsftpd FTP Server

1. 安裝 vsftpd FTP Server
# yum install -y vsftpd

2. 修改設定檔 /etc/vsftpd/vsftpd.conf
# grep -v ^# /etc/vsftpd/vsftpd.conf
anonymous_enable=No
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_file=/var/log/xferlog
idle_session_timeout=600
data_connection_timeout=120
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
allow_writeable_chroot=YES
listen=YES

pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES

pasv_enable=YES
pasv_min_port=5000
pasv_max_port=6000
use_localtime=YES[@more@]3. 讓 root 可以登入
# sed -i ‘s/root/#root/’ /etc/vsftpd/ftpusers
# sed -i ‘s/root/#root/’ /etc/vsftpd/user_list

4. 限制使用者不能切換到其它目錄,root 可以
# echo root > /etc/vsftpd/chroot_list

5. SELinux 在 vsftpd FTP Server 上的設定
# setsebool -P ftp_home_dir  on
# setsebool -P allow_ftpd_full_access  on

6. 設定開機時啟動
# # systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.

7. 啟動 vsftpd FTP Server
# systemctl start vsftpd

8. 檢查 FTP Server 是否有正常啟動
# netstat -ant | grep :21
tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN

關於 chroot 使用者的另一種做法
1. 修改 /etc/vsftpd/vsftpd.conf 設定檔
# grep ‘chroot’ /etc/vsftpd/vsftpd.conf | grep -v ‘^#’
chroot_local_user=NO
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
allow_writeable_chroot=YES

2. 建立要 chroot 的使用者
# awk -F: ‘{if ($3>999) print $1}’ /etc/passwd | grep -v nfsnobody > /etc/vsftpd/chroot_list

# awk -F: ‘{if ($3>999&&$3<60000) print $1}’ /etc/passwd > /etc/vsftpd/chroot_list

在 CentOS 7.x 上安裝 grive2 同步 Google Drive

1. 加入第三方套件庫 EPEL
# wget https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-7.noarch.rpm
# rpm -ivh epel-release-7-7.noarch.rpm

2. 更新套件庫
# yum update

3. 搜尋 grive2 套件
# yum search grive2
grive2.x86_64 : Google Drive client[@more@]
4. 進行安裝
# yum install grive2

5. 先開啟瀏覽器登入到要同步的 Google Drive 帳號:

6. 切換到要同步的目錄,並進行設定
# cd /home/t850008
# grive -a

7. 在下方產生網址

8. 將產生的網址,貼到瀏覽器網址列,按  Enter 鍵執行

9. 選擇 允許

10. 將產生的 授權碼 複製起來

11. 將產生的 授權碼 貼在下方,按  Enter 鍵執行

Reading local directories
Reading remote server file list
Synchronizing files
sync “./.bash_logout” doesn’t exist in server, uploading
sync “./.bash_profile” doesn’t exist in server, uploading
sync “./.bashrc” doesn’t exist in server, uploading
Finished!

12. 進行同步
# /usr/bin/grive -p /home/t850008
Reading local directories
Reading remote server file list
Synchronizing files
sync “/home/t850008/Windows 7 Games for Windows 10 and 8.exe” created in remote. creating local
sync “/home/t850008/pietty0327.exe” created in remote. creating local
sync “/home/t850008/VMware-player-12.1.0-3272444.exe” created in remote. creating local
sync “/home/t850008/.login_conf” created in remote. creating local
sync “/home/t850008/.mailrc” created in remote. creating local
sync “/home/t850008/.cshrc” created in remote. creating local
sync “/home/t850008/.profile” created in remote. creating local
sync “/home/t850008/.rhosts” created in remote. creating local
sync “/home/t850008/.mail_aliases” created in remote. creating local
sync “/home/t850008/.login” created in remote. creating local
sync “/home/t850008/.shrc” created in remote. creating local
Finished!

13. 進行工作排程
# crontab -e
*/5 * * * * /usr/bin/grive -p /home/t850008 > /dev/null 2>&1

 

在 CentOS 7.x 上使用 RAID 5

1. 安裝 mdadm 套件
# yum install mdadm

2. 查看目前磁碟狀態
# fdisk -l | grep ‘^Disk /dev/sd’
Disk /dev/sda: 10.7 GB, 10737418240 bytes
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
Disk /dev/sdc: 21.5 GB, 21474836480 bytes
Disk /dev/sdd: 21.5 GB, 21474836480 bytes
Disk /dev/sde: 21.5 GB, 21474836480 bytes

[@more@]3. 建立磁碟分割區
# fdisk /dev/sdb


重複上面的動作,完成所有的磁碟
# fdisk /dev/sdc
# fdisk /dev/sdd
# fdisk /dev/sde

4. 建立 /dev/md0 磁碟陣列分割區
# mdadm –create –verbose –auto=yes /dev/md0 –level=5 –raid-devices=4 /dev/sd[b-e]
mdadm: layout defaults to left-symmetric
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 512K
mdadm: /dev/sdb appears to be part of a raid array:
       level=raid0 devices=0 ctime=Thu Jan  1 08:00:00 1970
mdadm: partition table exists on /dev/sdb but will be lost or
       meaningless after creating array
mdadm: /dev/sdc appears to be part of a raid array:
       level=raid0 devices=0 ctime=Thu Jan  1 08:00:00 1970
mdadm: partition table exists on /dev/sdc but will be lost or
       meaningless after creating array
mdadm: /dev/sdd appears to be part of a raid array:
       level=raid0 devices=0 ctime=Thu Jan  1 08:00:00 1970
mdadm: partition table exists on /dev/sdd but will be lost or
       meaningless after creating array
mdadm: size set to 20955136K
Continue creating array? yes
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.

5. 查看建置結果
# fdisk -l | grep /dev/md0
Disk /dev/md0: 42.9 GB, 42916118528 bytes, 83820544 sectors

# mdadm -D /dev/md0
/dev/md0:
        Version : 1.2
  Creation Time : Thu Jun 30 03:31:44 2016
     Raid Level : raid5
     Array Size : 41910272 (39.97 GiB 42.92 GB)
  Used Dev Size : 20955136 (19.98 GiB 21.46 GB)
   Raid Devices : 3
  Total Devices : 3
    Persistence : Superblock is persistent

    Update Time : Thu Jun 30 03:36:27 2016
          State : clean, degraded, recovering
 Active Devices : 2
Working Devices : 3
 Failed Devices : 0
  Spare Devices : 1

         Layout : left-symmetric
     Chunk Size : 512K

 Rebuild Status : 47% complete

           Name : localhost.localdomain:0  (local to host localhost.localdomain)
           UUID : 40801919:fa833719:77db4a5b:bd3e0c50
         Events : 10

    Number   Major   Minor   RaidDevice State
       0       8       16        0      active sync   /dev/sdb
       1       8       32        1      active sync   /dev/sdc
       3       8       48        2      spare rebuilding   /dev/sdd

6. 格式化分割區 CentOS 7 改用 xfs
# mkfs.xfs /dev/md0
meta-data=/dev/md0               isize=256    agcount=16, agsize=654720 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=10475520, imaxpct=25
         =                       sunit=128    swidth=256 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=5120, version=2
         =                       sectsz=512   sunit=8 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

7. 查看硬碟的 UUID
# blkid | grep /dev/md0
/dev/md0: UUID=”fe9ac611-bb4a-4d85-87af-2998f6213cb8″ TYPE=”xfs”

8. 建立掛載目錄並掛載
# mkdir /mnt/raid5
# mount /dev/md0 /mnt/raid5
# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  8.5G  1.3G  7.2G  16% /
devtmpfs                 983M     0  983M   0% /dev
tmpfs                    993M     0  993M   0% /dev/shm
tmpfs                    993M  8.7M  985M   1% /run
tmpfs                    993M     0  993M   0% /sys/fs/cgroup
/dev/sda1                497M  153M  345M  31% /boot
tmpfs                    199M     0  199M   0% /run/user/0
/dev/md0                  40G   33M   40G   1% /mnt/raid5

9. 修改 /etc/fstab
# vim /etc/fstab
加入下面一行
UUID=fe9ac611-bb4a-4d85-87af-2998f6213cb8 /mnt/raid5                   xfs     defaults        0 0

10. 編輯 /etc/mdadm.conf  設定檔
# mdadm –detail –scan –verbose > /etc/mdadm.conf
# cat /etc/mdadm.conf
ARRAY /dev/md0 level=raid5 num-devices=3 metadata=1.2 spares=1 name=localhost.localdomain:0 UUID=40801919:fa833719:77db4a5b:bd3e0c50
   devices=/dev/sdb,/dev/sdc,/dev/sdd

在 CentOS 6.x 上使用 vsftpd FTP Server

1. 安裝 vsftpd FTP Server
# yum install -y vsftpd

2. 修改設定檔 /etc/vsftpd/vsftpd.conf
# grep -v ^# /etc/vsftpd/vsftpd.conf
anonymous_enable=No
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
listen=YES
pasv_enable=YES
pasv_min_port=5000
pasv_max_port=6000
use_localtime=YES

pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES[@more@]3. 讓 root 可以登入
# sed -i ‘s/root/#root/’ /etc/vsftpd/ftpusers
# sed -i ‘s/root/#root/’ /etc/vsftpd/user_list

4. 限制使用者不能切換到其它目錄,root 可以
# echo root > /etc/vsftpd/chroot_list

5. SELinux 在 vsftpd FTP Server 上的設定
# setsebool -P ftp_home_dir  on
# setsebool -P allow_ftpd_full_access  on

6. 設定開機時啟動
# chkconfig –level 3 vsftpd on

7. 啟動 vsftpd FTP Server
# service vsftpd start

8. 檢查 FTP Server 是否有正常啟動
# netstat -ant | grep :21
tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN

9. 防火牆設定
# iptables -A INPUT -m state –state NEW -m tcp -p tcp –dport 5000:6000 -j ACCEPT

在 CentOS 6.x 上使用 Samba 4

1. 搜尋 Samba 套件
# yum search samba | grep ^samba
samba-client.x86_64 : Samba client programs
samba-common.i686 : Files used by both Samba servers and clients
samba-common.x86_64 : Files used by both Samba servers and clients
samba-doc.x86_64 : Documentation for the Samba suite
samba-glusterfs.x86_64 : Samba VFS module for GlusterFS
samba-swat.x86_64 : The Samba SMB server Web configuration program
samba-winbind.x86_64 : Samba winbind
samba-winbind-clients.i686 : Samba winbind clients
samba-winbind-clients.x86_64 : Samba winbind clients
samba-winbind-krb5-locator.x86_64 : Samba winbind krb5 locator
samba4-client.x86_64 : Samba client programs
samba4-common.x86_64 : Files used by both Samba servers and clients
samba4-devel.x86_64 : Developer tools for Samba libraries
samba4-libs.x86_64 : Samba libraries
samba4-python.x86_64 : Samba Python libraries
samba4-test.x86_64 : Testing tools for Samba servers and clients
samba4-winbind.x86_64 : Samba winbind
samba4-winbind-clients.x86_64 : Samba winbind clients
samba4-winbind-krb5-locator.x86_64 : Samba winbind krb5 locator
samba.x86_64 : Server and Client software to interoperate with Windows machines
samba-domainjoin-gui.x86_64 : Domainjoin GUI
samba-winbind-devel.i686 : Developer tools for the winbind library
samba-winbind-devel.x86_64 : Developer tools for the winbind library
samba4.x86_64 : Server and Client software to interoperate with Windows machines
samba4-dc.x86_64 : AD Domain Controller placeholder package.
samba4-dc-libs.x86_64 : AD Domain Controller libraries placeholder package.
samba4-pidl.x86_64 : Perl IDL compiler

2. 安裝 Samba 4
# yum install -y samba4[@more@]3. 修改 /etc/samba/smb.conf 設定檔
# cat /etc/samba/smb.conf | grep -E -v ‘^#|^;’
[global]
        workgroup = HOME
        server string = Samba Server Version %v
        # log files split per-machine:
        log file = /var/log/samba/log.%m
        # maximum size of 50KB per log file, then rotate:
        max log size = 50

        security = user
        passdb backend = tdbsam

[homes]
        comment = Home Directories
        browseable = no
        writable = yes
        valid users = %S
        create mode = 0664
        directory mode = 0775
        veto files=/.*/

4. 測試設定檔
# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section “[homes]”
Loaded services file OK.
Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

# Global parameters
[global]
        workgroup = HOME
        server string = Samba Server Version %v
        security = USER
        log file = /var/log/samba/log.%m
        max log size = 50
        idmap config * : backend = tdb

[homes]
        comment = Home Directories
        valid users = %S
        read only = No
        create mask = 0664
        directory mask = 0775
        veto files = /.*/
        browseable = No

5. 建立使用者 Samba 密碼
# /usr/bin/pdbedit -a t850008
new password:
retype new password:
Unix username:        t850008
NT username:
Account Flags:        [U          ]
User SID:             S-1-5-21-1562595748-815096285-1647261660-1000
Primary Group SID:    S-1-5-21-1562595748-815096285-1647261660-513
Full Name:
Home Directory:       \localhostt850008
HomeDir Drive:
Logon Script:
Profile Path:         \localhostt850008profile
Domain:               LOCALHOST
Account desc:
Workstations:
Munged dial:
Logon time:           0
Logoff time:          Wed, 06 Feb 2036 23:06:39 CST
Kickoff time:         Wed, 06 Feb 2036 23:06:39 CST
Password last set:    Wed, 29 Jun 2016 09:06:19 CST
Password can change:  Wed, 29 Jun 2016 09:06:19 CST
Password must change: never
Last bad password   : 0
Bad password count  : 0
Logon hours         : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

6. SELinux 在 Samba Server 上的設定
# setsebool -P samba_enable_home_dirs on
# chcon -R -t samba_share_t /home/homework
# chcon -R -t samba_share_t /home/share

7. 啟動 Samba Server
# /etc/init.d/smb start
# /etc/init.d/nmb start

8. 檢查 Samba Server 是否有正常啟動
# netstat -an | grep -E ‘:137|:138|:139|:445’
tcp        0      0 0.0.0.0:445                 0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:139                 0.0.0.0:*                   LISTEN
tcp        0      0 :::445                      :::*                        LISTEN
tcp        0      0 :::139                      :::*                        LISTEN
udp        0      0 0.0.0.0:137                 0.0.0.0:*
udp        0      0 0.0.0.0:138                 0.0.0.0:*

9. 設定開機時啟動 Samba Server
# chkconfig –level 3 smb on
# chkconfig –level 3 nmb on

10. 防火牆上的設定
防火牆設定 設定內部網路 IP 192.168.1.0/24
# iptables -A INPUT -s 192.168.1.0/24 -m state –state NEW -m udp -p udp –dport 137 -j ACCEPT
# iptables -A INPUT -s 192.168.1.0/24 -m state –state NEW -m udp -p udp –dport 138 -j ACCEPT
# iptables -A INPUT -s 192.168.1.0/24 -m state –state NEW -m tcp -p tcp –dport 139 -j ACCEPT
# iptables -A INPUT -s 192.168.1.0/24 -m state –state NEW -m tcp -p tcp –dport 445 -j ACCEPT
# iptables -A INPUT -s 192.168.1.0/24 -m state –state NEW -m udp -p udp –dport 445 -j ACCEPT

在 CentOS 6.x 上使用 RAID 5

1. 安裝 mdadm 套件
# yum install mdadm

2. 查看目前磁碟狀態
# fdisk -l | grep ‘^Disk /dev/sd’
Disk /dev/sda: 10.7 GB, 10737418240 bytes
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
Disk /dev/sdc: 21.5 GB, 21474836480 bytes
Disk /dev/sdd: 21.5 GB, 21474836480 bytes
Disk /dev/sde: 21.5 GB, 21474836480 bytes[@more@]

3. 建立磁碟分割區
# fdisk /dev/sdb


重複上面的動作,完成所有的磁碟
# fdisk /dev/sdc
# fdisk /dev/sdd
# fdisk /dev/sde

4. 建立 /dev/md0 磁碟陣列分割區
# mdadm –create –verbose –auto=yes /dev/md0 –level=5 –raid-devices=4 /dev/sd[b-e]
mdadm: layout defaults to left-symmetric
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 512K
mdadm: /dev/sdb appears to be part of a raid array:
       level=raid0 devices=0 ctime=Thu Jan  1 08:00:00 1970
mdadm: partition table exists on /dev/sdb but will be lost or
       meaningless after creating array
mdadm: /dev/sdc appears to be part of a raid array:
       level=raid0 devices=0 ctime=Thu Jan  1 08:00:00 1970
mdadm: partition table exists on /dev/sdc but will be lost or
       meaningless after creating array
mdadm: /dev/sdd appears to be part of a raid array:
       level=raid0 devices=0 ctime=Thu Jan  1 08:00:00 1970
mdadm: partition table exists on /dev/sdd but will be lost or
       meaningless after creating array
mdadm: /dev/sde appears to be part of a raid array:
       level=raid0 devices=0 ctime=Thu Jan  1 08:00:00 1970
mdadm: partition table exists on /dev/sde but will be lost or
       meaningless after creating array
mdadm: size set to 20955136K
Continue creating array? yes
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.

5. 查看建置結果
# fdisk -l | grep /dev/md0
Disk /dev/md0: 64.4 GB, 64374177792 bytes

# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sde[4] sdd[2] sdc[1] sdb[0]
      62865408 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/3] [UUU_]
      [>………………..]  recovery =  2.8% (607044/20955136) finish=6.7min speed=50587K/sec

unused devices: <none>

# mdadm -D /dev/md0
/dev/md0:
        Version : 1.2
  Creation Time : Wed Jun 29 08:16:51 2016
     Raid Level : raid5
     Array Size : 62865408 (59.95 GiB 64.37 GB)
  Used Dev Size : 20955136 (19.98 GiB 21.46 GB)
   Raid Devices : 4
  Total Devices : 4
    Persistence : Superblock is persistent

    Update Time : Wed Jun 29 08:17:14 2016
          State : clean, degraded, recovering
 Active Devices : 3
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 1

         Layout : left-symmetric
     Chunk Size : 512K

 Rebuild Status : 6% complete

           Name : localhost.localdomain:0  (local to host localhost.localdomain)
           UUID : 17b9df4d:e3542df5:34c1a172:298a07a5
         Events : 2

    Number   Major   Minor   RaidDevice State
       0       8       16        0      active sync   /dev/sdb
       1       8       32        1      active sync   /dev/sdc
       2       8       48        2      active sync   /dev/sdd
       4       8       64        3      spare rebuilding   /dev/sde

6. 格式化分割區
# mkfs -t ext4 /dev/md0
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=128 blocks, Stripe width=384 blocks
3932160 inodes, 15716352 blocks
785817 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
480 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

7. 建立掛載目錄並掛載
# mkdir /mnt/raid5
# mount /dev/md0 /mnt/raid5
# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                      8.3G 1022M  6.9G  13% /
tmpfs                 931M     0  931M   0% /dev/shm
/dev/sda1             477M   63M  389M  14% /boot
/dev/md0               59G   52M   56G   1% /mnt/raid5

8. 查看硬碟的 UUID
# blkid | grep /dev/md0
/dev/md0: UUID=”a24bbe2b-c0f1-4417-99d9-866ea1f2a33d” TYPE=”ext4″

9. 修改 /etc/fstab
# vim /etc/fstab
加入下面一行
UUID=a24bbe2b-c0f1-4417-99d9-866ea1f2a33d /mnt/raid5                   ext4    defaults        1 1

10. 編輯 /etc/mdadm.conf  設定檔
# mdadm –detail –scan –verbose >> /etc/mdadm.conf
ARRAY /dev/md0 level=raid5 num-devices=4 metadata=1.2 name=localhost.localdomain:0 UUID=232bc54c:6583d975:ab90c836:78be7854
   devices=/dev/sdb,/dev/sdc,/dev/sdd,/dev/sde

11. 重新啟動電腦
# reboot

12. 磁碟分割資訊
# fdisk -l | grep /dev/sd
Disk /dev/sda: 10.7 GB, 10737418240 bytes
/dev/sda1   *           1          64      512000   83  Linux
/dev/sda2              64        1306     9972736   8e  Linux LVM
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
/dev/sdb1               1        2610    20964793+  fd  Linux raid autodetect
Disk /dev/sdc: 21.5 GB, 21474836480 bytes
/dev/sdc1               1        2610    20964793+  fd  Linux raid autodetect
Disk /dev/sdd: 21.5 GB, 21474836480 bytes
/dev/sdd1               1        2610    20964793+  fd  Linux raid autodetect
Disk /dev/sde: 21.5 GB, 21474836480 bytes
/dev/sde1               1        2610    20964793+  fd  Linux raid autodetect

13. 檢查是否有正確掛載
# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                      8.3G 1022M  6.9G  13% /
tmpfs                 931M     0  931M   0% /dev/shm
/dev/sda1             477M   63M  389M  14% /boot
/dev/md0               59G   52M   56G   1% /mnt/raid5

客製化 CentOS 6.8 x86 & x86_64 Server 光碟

安裝 CentOS 6.8 x86_64 Server 只要二步驟:設定 root 管理者密碼分割硬碟

已經取消倒數計時
[@more@]設定 root 管理者密碼

分割硬碟

安裝過程,安裝 306 個套件

安裝完畢

這個版本的特點:
1. 最小化安裝,再補上所需套件,x86-64 光碟容量 498M,x86 光碟容量 445M
2. 套件更新到 2016-05-27
3. 套件更新伺服器改成頭城國小
4. 預設啟動 LAMP (Linux + Apache + MySQL + PHP)
5. Apache Web Server 增加一些安全性上的設定
    ServerTokens Prod
    ServerSignature Off
6. MySQL Server 修改成 UTF-8 的使用環境
7. PHP 部分的設定,僅列出部份的修改
    時區改成 Asia/Taipei
    upload_max_filesize = 500M
    post_max_size = 500M
8. 每天早上 6 點向 time.stdtime.gov.tw 對時
9. 個人使用環境的設定…..等等

CentOS Linux 6.8

CentOS Linux 6.8 已經釋出,可以下載 ISO 檔來安裝,或使用 yum update 來更新到最新版本。
# yum update

CentOS Linux ISO 6.8 版下載
i386
樹德科技大學
ftp://ftp.stu.edu.tw/Linux/CentOS/6.8/isos/i386/
元智大學
ftp://ftp.yzu.edu.tw/Linux/CentOS/6.8/isos/i386/
國立交通大學資訊工程學系
http://centos.cs.nctu.edu.tw/6.8/isos/i386/
Hinet IDC
http://mirror01.idc.hinet.net/CentOS/6.8/isos/i386/
義守大學
http://ftp.isu.edu.tw/pub/Linux/CentOS/6.8/isos/i386/
崑山科技大學
http://ftp.ksu.edu.tw/pub/CentOS/6.8/isos/i386/
國家高速網路與計算中心
ftp://ftp.twaren.net/Linux/CentOS/6.8/isos/i386/
頭城國小
ftp://140.111.74.109/CentOS/6.8/isos/i386/

[@more@]
x86_64
樹德科技大學
ftp://ftp.stu.edu.tw/Linux/CentOS/6.8/isos/x86_64/
元智大學
ftp://ftp.yzu.edu.tw/Linux/CentOS/6.8/isos/x86_64/
國立交通大學資訊工程學系
http://centos.cs.nctu.edu.tw/6.8/isos/x86_64/
Hinet IDC
http://mirror01.idc.hinet.net/CentOS/6.8/isos/x86_64/
義守大學
http://ftp.isu.edu.tw/pub/Linux/CentOS/6.8/isos/x86_64/
崑山科技大學
http://ftp.ksu.edu.tw/pub/CentOS/6.8/isos/x86_64/
國家高速網路與計算中心
ftp://ftp.twaren.net/Linux/CentOS/6.8/isos/x86_64/
頭城國小
ftp://140.111.74.109/CentOS/6.8/isos/x86_64/

客製化 CentOS 6.7 x86_64 LEMP Server 安裝光碟

閒暇時做的,主要是改安裝 Nginx Web Server + MariaDB SQL Server + PHP,並參考 將 CentOS 6、CentOS 7 的核心升級至 Linux 4.x | iLog,把核心升級到 4.x
已經取消 倒數計時

[@more@]安裝完成

CentOS 6.x 目前系統核心
# uname -a
Linux localhost.localdomain 2.6.32-573.18.1.el6.x86_64 #1 SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

CentOS 6.x 更新完後系統核心
# uname -a
Linux localhost.localdomain 4.5.0-1.el6.elrepo.x86_64 #1 SMP Mon Mar 14 12:11:26 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux

這個版本的特點:
1. 安裝只要二步驟:設定 root 管理者密碼分割硬碟
2. 套件更新到 2016-03-22
3. 套件更新伺服器改成 頭城國小
4. 預設啟動 LEMP (Linux + Nginx + MariaDBSQL + PHP)
5. MariaDBSQL Server 修改成 UTF-8 的使用環境
6. PHP 部分的設定,僅列出部份的修改
    時區改成 Asia/Taipei
    upload_max_filesize = 500M
    post_max_size = 500M
7. 每天早上 6 點向 time.stdtime.gov.tw 對時
8. 個人使用環境的設定…..等等

LEMP server on CentOS 7.x with FastCGI

參考網頁:LEMP server on CentOS 7 with FastCGI

安裝 epel-release 套件
# yum install epel-release

安裝 Mariadb SQL Server
# yum install mariadb-server mariadb

啟動 Mariadb SQL Server
# systemctl enable mariadb
# systemctl start mariadb

第一次使用時的設定
# /usr/bin/mysql_secure_installation[@more@]安裝 Nginx Web Server
# yum install nginx

修改設定檔 /etc/nginx/nginx.conf
# vim /etc/nginx/nginx.conf
server 區段中加入
   server {
        listen       80 default_server;
        (略)

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }

        location ~ .php$ {
            root           /usr/share/nginx/html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
    }

啟動 Nginx Web Server
# systemctl enable nginx
# systemctl start nginx

開啟防火牆設定
# firewall-cmd –permanent –zone=public –add-service=http
# firewall-cmd –permanent –zone=public –add-service=https

安裝 PHP with FastCGI 套件
# yum install php-cli php spawn-fcgi

新增 /usr/bin/php-fastcgi 設定檔
# vim /usr/bin/php-fastcgi
#!/bin/sh
if [ `grep -c “nginx” /etc/passwd` = “1” ]; then
    FASTCGI_USER=nginx
elif [ `grep -c “www-data” /etc/passwd` = “1” ]; then
    FASTCGI_USER=www-data
elif [ `grep -c “http” /etc/passwd` = “1” ]; then
    FASTCGI_USER=http
else
# Set the FASTCGI_USER variable below to the user that
# you want to run the php-fastcgi processes as

FASTCGI_USER=
fi

/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 6 -u $FASTCGI_USER -f /usr/bin/php-cgi

更新檔案權限
# chmod +x /usr/bin/php-fastcgi

新增 /etc/systemd/system/php-fastcgi.service 設定檔
# vim /etc/systemd/system/php-fastcgi.service
[Unit]
Description= php-fastcgi systemd service script

[Service]
Type=forking
ExecStart=/usr/bin/php-fastcgi start

[Install]
WantedBy=multi-user.target

啟動相關服務
# systemctl daemon-reload
# systemctl enable php-fastcgi.service
# systemctl start php-fastcgi.service