分類:Linux

Linux

CentOS7 安裝VMware tools

 

在CentOS7虛擬機安裝VMware tools , 掛接光碟

CentOS-211

在虛擬機新增資料夾,掛接光碟

mkdir /mnt/cdrom

mount /dev/cdrom /mnt/cdrom

CentOS-212

解壓縮 VMwareTools 至 /tmp 下 -C 要大寫

tar xzvf /mnt/cdrom/VMwareTools-10.0.6-3560309.tar.gz –C /temp/

cd /tmp/vmware-tools-distrib

CentOS-214

安裝  ./vmware-install

CentOS-215

上網找了一下安裝方法,發現應該是少了某些套件,執行下以下指令

 

 

 

yum -y install perl gcc make kernel-headers kernel-devel

再次執行  ./vmware-install , 輸入 yes開始安裝,一連串的交互問答,按enter,以預設值繼續

CentOS-218

完成

CentOS-219

reboot

CentOS-220

Clipbucket上傳YouTube影片

(1)在Youtube 找到要上傳的影片,複製網頁網址,例如

(2)登入clipbucket,點選上傳影片 Upload Videoupdate_41

(3)點選遠端上傳,貼上YouTube網址,按下 從YouTube抓取,順利的話,即可得到影片的相關資訊,並完成影片上傳,唯更新影片資訊似乎沒有作用,按下Submit now可以繼續上傳下一影片upload-12upload-13

(4)YouTube如無法抓取相關資訊,通常是因為上傳時未編輯影片基本資訊所造成,若是自己上傳的影片,登入YouTube後編輯影片資訊更新,通常即可讓ClipBucket抓到相關資訊,完成上傳,在clipbucket中編輯影片資訊時可以發現,影片內容只是嵌入碼,影片來源還是在YouTube,但有個好處是少了YouTube的廣告upload-14

 

ClipBucket升級

收到 ClipBucket 2.8 的郵件已有一段時日,從2.6版安裝完成至今也有一段時日,突然心血來潮想把它升級,看看有沒有多出新功能,從官網http://clip-bucket.com/的畫面看來應該有支援RWD,可以讓各種行動裝置使用,還滿合乎現在的驅勢,就來給他升級吧

clipbucket

  1. 2.6版畫面先留張做記念
    clipbucket26
  2. 備份資料庫,先把資料庫備份下來,升級如有問題或者後悔了還可以還原
    cp-backup01選擇clipbucket資料庫備份cp-backup02下載.sql檔cp-backup03
  3. 備份clipbucket 2.6網站程式、照片及影片,使用putty , 不想備份的話可以略過此一步驟
    新增備份資料夾
    # mkdir clipbucket-backup
    # cd clipbucket-backup
    #原來的照片與影片不少,如要整個備份可能會把硬碟給塞滿,先把他移到以下幾個資料夾videos, photos, thumbs,再來備份網站
    # mkdir videos
    # mkdir photos
    # mkdir thumbs
    移動照片
    # mv /var/www/html/clipbucket/files/photos/* photos/移動縮圖
    # mv /var/www/html/clipbucket/files/thumbs/* thumbs/移動影片
    # mv /var/www/html/clipbucket/files/videos/* videos/備份clipbucket 網站
    # tar -zcvf clipbucket.tar.gz /var/www/html/clipbucket要還原時,刪除未升級成功的網站,將解開的壓縮檔整個貼回去,記得資料庫也要比照辦理
    # tar -zxvf clipbucket.tar.gz
  4. 取得升級檔 https://sourceforge.net/projects/clipbucket/
    Clipbucket 2.8.v3354-stable 下載:
    # http://downloads.sourceforge.net/project/clipbucket/ClipBucket%20v2/clipbucket-2.8.v3354-stable.zip
    解壓縮
    # unzip clipbucket-2.8.v3354-stable.zip
    # cd clipbucket-2.8.v3354-stable
    # ll
  5. 上傳更新檔 upload資料夾
    # cd upload
    將解開後在clipbucket-2.8.v3354 的upload資料夾中所有檔案上傳至clipbucket,覆蓋所有原來的檔案
    # /bin/cp -rf * /var/www/html/clipbucket/更改 clipbucket 網站權限
    # chmod 755 -R /var/www/html/clipbucket/切換至/var/www/html/clipbucket/,更改clipbucket下的相關資料夾權限
    # cd /var/www/html/clipbucket/
    # chmod 777 includes
    # chmod 777 files
    # chmod 777 files/conversion_queue
    # chmod 777 files/logs
    # chmod 777 files/original
    # chmod 777 files/temp
    # chmod 777 files/thumbs
    # chmod 777 files/photos
    # chmod 777 files/videos
    # chmod 777 files/mass_uploads
    # chmod 777 files/temp/install.me
    # chmod 777 images
    # chmod 777 images/avatars
    # chmod 777 images/backgrounds
    # chmod 777 images/collection_thumbs
    # chmod 777 images/category_thumbs
    # chmod 777 images/groups_thumbs
    # chmod 777 includes/langs/*
    # chmod 777 cache
    # chmod 777 cache/comments
    # chmod 777 cache/userfeeds
    # chmod 777 cb_install
  6. 升級 clipbucket
    從瀏覽器中打開 clipbucket 網站執行 cb_install,如 http://ip/clipbucket/cb_install
    update_11
    Continue to upgrade!資料夾設定未完,請至第5步驟,更新所有相關資料夾權限至777,再重新整理一次update_12-1更改權限後,重新整理如下圖
    update_12升級完成,continue to clipbucket v2 回首頁看看update_13除了圖片不見、影片不見,中文字顯示也不正常
    update_31播放影片也出現如下錯誤update_33處理如下
    (1)將備份的圖片、縮圖和影片搬回原處
    #  mv /home/lai/clipbucket-backup/photos/* /var/www/html/clipbucket/files/photos/
    #  mv /home/lai/clipbucket-backup/thumbs/* /var/www/html/clipbucket/files/thumbs/
    #  mv /home/lai/clipbucket-backup/videos/* /var/www/html/clipbucket/files/videos/
    update_32(2)解決 PHP 連 MySQL 亂碼的問題,參考網頁
    #vi /var/www/html/clipbucket/includes/dbconnect.php
    在 $db->connect($DBHOST,$DBNAME,$DBUSER,$DBPASS); 這行下面加入以下三行
    $db->Execute(‘SET NAMES utf8’);
    $db->Execute(‘SET CHARACTER SET utf8’);
    $db->Execute(‘SET COLLATION_CONNECTION="utf8_general_ci"‘);
    update_34-1重新整理後,中文已正常
    update_35(3)播放影片出現問題的處理,以管理者登入update_36從右上角的下拉選單Admin area進入管理介面
    update_37
    點選左邊選單 Templates And Players 的  Players Manager,點選 ClipBucket (CB) Player 1.0 Activate This Player,設為預設的播放器,點右上角的home回clipbucket首頁試試影片播放是否正常了update_38update_40回到Admin area管理頁面,黃色的字You must update “Server Configurations",點選 details,請根據提示更新php的設定值update_39# vi /etc/php.ini
    apache重啟
    # /etc/rc.d/init.d/httpd restart
  7. 上傳影片進行轉檔測試
    點選右上角upload 或下拉選單的Upload Video
    update_41支援拖曳的方式多檔上傳,或點選Select Videos上傳檔案,上傳一個小檔案來看看轉檔是否成功update_42點選右上角 Admin area切換至管理模式,點選 Videos 的 Video mamanger,可以發現剛剛剛上傳的兩個檔案都沒成功
    update_43
    點選轉檔失敗的最右邊的Actions,從下拉選單點選 File conversion details,檢視轉檔結果,除了上傳的檔案影片的長宽無法偵測,ffmpeg 轉檔出現了 Unrecognized option ‘preset’ ,看來應該要更新ffmpegs了。update-06 ffmpeg output
    update_44
  8. CentOS更新
    將CentOS6的更新指定為國內大學ftp站
    # cd /etc/yum.repos.d/
    先把設定檔備份一下
    # cp CentOS-Base.repo CentOS-Base.repo.bak
    進行編輯
    # vi CentOS-Base.repo
    將檔案中baseurl 中的 mirror.centos.org/centos 換成 義守大學 ftp.isu.edu.tw/pub/Linux/CentOS 或 國網 ftp.twaren.net/Linux/CentOS , 首字 # 字順便拿掉,如下,其他依此類推# CentOS-Base.repo
    #
    # The mirror system uses the connecting IP address of the client and the
    # update status of each mirror to pick mirrors that are updated to and
    # geographically close to the client. You should use this for CentOS updates
    # unless you are manually picking other mirrors.
    #
    # If the mirrorlist= does not work for you, as a fall back you can try the
    # remarked out baseurl= line instead.
    #
    #[base]
    name=CentOS-$releasever – Base
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
    #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
    baseurl=http://ftp.isu.edu.tw/pub/Linux/CentOS/$releasever/os/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#released updates
    [updates]
    name=CentOS-$releasever – Updates
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
    #baseurl=http//mirror.centos.org/centos/$releasever/updates/$basearch/
    baseurl=http://ftp.isu.edu.tw/pub/Linux/CentOS/$releasever/updates/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#additional packages that may be useful
    [extras]
    name=CentOS-$releasever – Extras
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
    #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
    baseurl=http://ftp.isu.edu.tw/pub/Linux/CentOS/$releasever/extras/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages
    [centosplus]
    name=CentOS-$releasever – Plus
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
    #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
    baseurl=http://ftp.isu.edu.tw/pub/Linux/CentOS/$releasever/centosplus/$basearch/
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#contrib – packages by Centos Users
    [contrib]
    name=CentOS-$releasever – Contrib
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
    #baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
    baseurl=http://ftp.isu.edu.tw/pub/Linux/CentOS/$releasever/contrib/$basearch/
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
  9. 更新所有已安裝的套件
    # yum updateupdate_51
    在update後面接上套件名稱的話可針對該套件更新
    # yum update httpd更新時出現的錯誤
    update_52解決方式:參考網頁
    匯入新的key,方法如下
    # rpm –import https://www.atomicorp.com/RPM-GPG-KEY.atomicorp.txt
    再次更新看看
    # yum update
  10. 更新ffmpeg,參考網頁:建立ClipBucket影音網站的完整步驟CentOS安裝ffmpeg方法
    先記錄一下ffmpeg更新前的版本
    # ffmpeg
    ffmpeg-before
    透過 EPEL Repo 來安裝 ,可以安裝的版本較新
    # yum -y install epel-release && rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm安裝 ffmpeg
    # yum -y install ffmpeg ffmpeg-devel
    出現錯誤:Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again:
    update_53 解決方法:請參考 在Centos 5.x或6.x上安装RHEL EPEL Repo ,或先移除ffmpeg,再重裝
    # yum remove ffmpeg ffmpeg-devel
    # yum -y install ffmpeg ffmpeg-devel
    # ffmpeg
    ffmpeg-afterffmpeg 升級完成,重新上傳影片轉檔試試
    update_55update_56
    升級成功
  11. 安裝其他相關套件
    檢查以下套件是否存在
    update_57
    (1)安裝 Media Info
    # yum –enablerepo extras install epel-release
    # yum install mediainfo-gui mediainfo libmediainfo
    (2)安裝 ImageMagick
    # yum install -y gcc php-devel php-pear
    # yum install -y ImageMagick ImageMagick-devel
    # yum install ImageMagick-perl
    別忘了還要把以下這一行加到/etc/php.ini中(任何一個地方均可)
    extension=imagick.so重啟apache
    # /etc/rc.d/init.d/httpd restart

LVM 擴增容量

 

5063f799a0c5d

在fdisk中查出LVM的type是8e

 

5063f7a3763ef

以 fdisk /dev/sdb 針對sdb 新增Partition , 分割表類型8e , 接受LVM管理

5063f7ac3af65

fdisk -l,看到剛新增的partition叫/dev/sdb1

LV的是由VG(Volume Group)劃出來的,而VG是由PV(Physical Volum)組合而成的,所以要擴充LV,就要將分割好的partition轉成PV,以做後續的使用,指令如下

pvcreate /dev/sdb1,由上圖看到新增的partition是/dev/sdb1,將它轉換成PV

pvscan

pvscan 一下

lvdisplay

lvdisplay 一下 , 將LVpath 與 VGname 記錄下來

vgextend  VolGroup /dev/sdb1,PV做好後,將PV加入VG,做VG的擴充,VG的名字由上圖得知

vgdisplay

vgdisplay
可以看出不但整體 VG 變大了!而且剩餘的 PE 共有 12799 個,容量則為 50G
接下來,放大 LV 吧!利用 lvresize 的功能來增加!

lvresize -l +12799 /dev/VolGroup/LogVol00

df指令可以看到實際大小沒改變,

將擴充後的LV 的容量擴充到整個 filesystem 吧!
resize2fs /dev/VolGroup/LogVol00

resize

在CentOS7 下執行卻出現了以下畫面

resize2fs: Bad magic number in super-block while trying to open

上網查了一下,CentOS 7 要將 resize2fs 改成  xfs_growfs

cp 指令

為什麼 cp 會一直出現是不是要覆寫的確認訊息呢?
明明 cp –help 裡面也提到 -f 的參數使用方式:
-f, –force if an existing destination file cannot be opened, remove it and try again。
可是即使加上了這個參數仍舊無法直接覆蓋 @@

原來 cp 預設會被設定成別名:alias cp=’cp -i’,
也就是使用了參數 cp 時都會自動改用 cp -i,-i 是 interactive 互動的縮寫,
所以不管你說了什麼,他就是要來跟我們「互動」一下 orz。

解決方法很簡單,避開別名 cp,直接使用 /bin/cp 就可以囉

或者用更直接的方式,取消 cp 的別名:
[root@centos demo]# unalias cp

tar 指令

如何打包
tar [-cvfz] [tar ball檔案] [被tar的檔案或目錄]

c create一個tar ball
f 指定tar ball檔名
v verbose,列出過程
z 使用gzip壓縮 tar ball

例 tar -zcvf etc.tar.gz /etc/*

三、如何解出
tar [-xvfz] [tar ball檔案] [被tar的檔案或錄]

x 解出tar ball
f 指定tar ball檔名
v verbose,列出過程
z 使用gzip解壓縮(.gz)

tar -zxvf etc.tar.gz /home/

clonezilla 備份出現錯誤

進行ezgo備份時,在sda1出現以下的誤錯,sda1無法完成備份

錯誤訊息如下圖,大概內容:bitmap free count err, free: 6871416 Partclone fial, please check /var/log/partclone.log

PIC000223

上網查詢後,在備份時,由專家模式,是否修正分割區檔案:勾選 –fscksrcpart 即可完成備份,備份ms的win7沒有出現這個問題,用入門模式一直下一步即可完成。

5167b90d68562