2020年10月30日 星期五

Linux "CP"

 Linux 怎麽在複製檔案或目錄保留原來的資料夾中所有的檔的屬性、連結等也就是說要建立原來資料夾的一份一模一樣的副本?

例如要把 "/home" 這個目錄裏面檔案複製到 "/mnt/newhome"

# cp -avx /home/* /mnt/newhome

ge選項如下:

  • -a --archive ,此選項通常在複製目錄時使用,它保留連結、檔案屬性,並複製目錄下的所有內容。其作用等於dpR參數組

  • -b --backup 刪除、覆蓋目的檔先備份,備份的檔或目錄亦建立為符號連結,並指向原始檔案或目錄連結的原始檔案或目錄。如果沒有加上這個參數,在複製過程中若遇到符號連結,則會直接複製原始檔案或目錄

  • -d:複製時保留連結,這連結類似於Windows的快捷方式

  • -f --force 強行複製檔或目錄, 不論目的檔或目錄是否已經存在

  • -i --interactive 覆蓋檔之前先詢問用戶

  • -l --link 對原始檔案建立硬連結,而非複製檔, 

  • -p --preserve 保留原始檔案或目錄的屬性,包括所有者、所屬組、許可權與時間

  • -P --parents 保留原始檔案或目錄的路徑,此路徑可以是絕對路徑或相對路徑,同時目的目錄已經存在

  • -r 遞迴處理,將指定目錄下的檔與子目錄一併處理。若原始檔案或目錄的形態,不屬於目錄或符號連結,則一律視為普通檔處理

  • -R --recursive 遞迴處理,將指定目錄下的檔及子目錄一併處理

  • -s --symbolic-link 對原始檔案建立符號連結,而非複製檔

  • -S <備份字尾字串> --suffix=<備份字尾字串> "-b"參數備份目的檔後,備份檔案的字尾會被加上一個備份字串。預設的備份字尾符串是符號"~"

  • -u --update 使用這項參數之後,只會在原始檔案的修改時間(Modification Time)較目的檔更新時,或是名稱相互對應的目的檔並不存在,才複製檔

  • -v --verbose 顯示執行過程

  • -V <備份方式> --version-control=<備份方式> 指定當備份檔案時,備份檔案名的命名方式有3:

  1. numberedt, 將使用備份編號,會在字尾加上~1~字串,其數位編號依次遞增

  2. simplenever 將使用簡單備份,預設的備份字尾字串是~, 也可通過-S來指定

  3. existingnil將使用當前方式,程式會先檢查是否存在著備份編號,若有則採用備份編號,若無則採用簡單備份

  • -x --one-file-system 複製的檔或目錄存放的檔案系統,必須與cp指令執行時所處的檔案系統相同,否則不複製,亦不處理位於其他分區的文

2020年10月26日 星期一

Install Centos8

 Dell 710 Server Install CentOS 8.2

Downlead diver for Dell 710, 注意8.2 與8.1 有分別

https://elrepo.org/linux/dud/el8/x86_64/dd-megaraid_sas-07.710.50.00-1.el8_2.elrepo.iso

Copy to  USB and format under FAT32 rather NTFS !!

Put USB to Server with OS DVD (Or USB) 

到了Install 畫面, 按"TAB", 在底部那行加入 inst.dd=/dev/sda1

Start Install ( Default is "Server with GUI", suggest "Minimal Install" )

--------------------------------------

Install GUI 

yum -y groupinstall "Server with GUI"

......

systemctl set-default graphical

.....

reboot

-----------------------------------

dnf insted yum

指令與YUM一樣

check version:

dnf --version


-----------

after install, yum update not work "Failed to download metadata for repo ‘AppStream’: Cannot prepare internal mirrorlist: No URLs in mirrorlist”"

cd /etc/yum.repos.d

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*

sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo

如果沒有Wget. 可以執行 "yum install wget "

下載完成后執行

yum clean all

yum makecache

then, 

yum update

----Seems all steps must be performed once after the update. otherwise, no repo is workable---

2020年10月4日 星期日

MailScanner show error

 MailScanner show error:

User's home directory /var/spool/postfix is not writable
You need to set the "SpamAssassin User State Dir" to a directory that the "Run As User" can write to

make sure  directory " /var/spool/postfix " owner is postfix

and MailScanner.conf

Run As User = postfix

 

 

Delete unused Linux Core

 

Check running core
# uname -a
 List all core
# rpm -q kernel
delete unwanted  core
# yum remove kernel (Kernet file name , example : kernel-3.10.0-1127.10.1.el7.x86_64 )
 wait for done

 YUM ( or DNF) upgrade PHP  listed running PHP version yum list installed |grep PHP Remove the old version yum remove php* Then install the ...