Partner Việt Nam – Đối tác chiến lược cho doanh nghiệp https://partner.com.vn Sun, 06 Dec 2020 16:44:12 +0000 vi hourly 1 https://wordpress.org/?v=6.1.1 Lệnh kiểm tra các thông số VPS Linux CentOS https://partner.com.vn/lenh-kiem-tra-cac-thong-so-vps-linux-centos/ https://partner.com.vn/lenh-kiem-tra-cac-thong-so-vps-linux-centos/#respond Sun, 29 Nov 2020 04:06:43 +0000 https://partner.com.vn/?p=350 Lệnh kiểm tra CPU:
# cat /proc/cpuinfo

Lệnh theo dõi CPU:
# top -c

Lệnh kiểm tra hệ điều hành:
# uname -a

Lệnh kiểm tra phiên bản hệ điều hành:
# cat /etc/redhat-release

Lệnh kiểm tra Ram:
# free -m

Lệnh kiểm tra HDD:
# df -h

Lệnh kiểm tra tốc độ đọc ghi HDD:
# dd if=/dev/zero of=1GB.tmp bs=1024 count=1M conv=fdatasync

]]>
https://partner.com.vn/lenh-kiem-tra-cac-thong-so-vps-linux-centos/feed/ 0
Tải file Google Drive sử dụng wget https://partner.com.vn/tai-file-google-drive-su-dung-wget/ https://partner.com.vn/tai-file-google-drive-su-dung-wget/#respond Sun, 14 Jun 2020 07:40:17 +0000 http://partner.com.vn/?p=334
  • Truy cập Drive và click chuột phải vào file cần tải về
  • Click Share. 
  • Click nút Change ở cuối hộp hội thoại
  • Copy the link for sharing…like…https://drive.google.com/file/d/1UibyVC_C2hoT_XEw15gPEwPW4yFyJFeOEA/view?usp=sharing
  • Extrac FILEID part like….from above….1UibyVC_C2hoT_XEw15gPEwPW4yFyJFeOEA
  • wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O backup.zip && rm -rf /tmp/cookies.txt
    ]]>
    https://partner.com.vn/tai-file-google-drive-su-dung-wget/feed/ 0
    Tự động backup website trên Cyberpanel lên Google Drive sử dụng Rclone https://partner.com.vn/tu-dong-backup-website-tren-cyberpanel-len-google-drive-su-dung-rclone/ https://partner.com.vn/tu-dong-backup-website-tren-cyberpanel-len-google-drive-su-dung-rclone/#respond Sat, 13 Jun 2020 21:13:08 +0000 http://partner.com.vn/?p=319 Rclone là một công cụ đồng bộ hóa dữ liệu tương tự Rsync nhưng lại được tập trung phát triển chức năng kết nối với các dịch vụ lưu trữ đám mây.

    Ưu điểm của việc sử dụng dịch vụ lưu trữ đám mây đó là tốc độ cao (do có server được đặt trên khắp thế giới), an toàn dữ liệu (không lo ngại các vấn đề phần cứng, network) và nhất là hầu hết đều Free. Mình đặc biệt thích những thứ Free!

    Rclone hỗ trợ rất nhiều dịch vụ Cloud thông dụng như:

    • Google Drive
    • Amazon S3
    • Openstack Swift / Rackspace cloud files / Memset Memstore
    • Dropbox
    • Google Cloud Storage
    • Amazon Drive
    • Microsoft OneDrive
    • Hubic
    • Backblaze B2
    • Yandex Disk
    • SFTP
    • The local filesystem

    Giờ thay vì backup đưa lên VPS khác để lưu trữ, mình chuyển sang sử dụng Google Drive, dung lượng miễn phí 15GB, mua thêm cũng khá rẻ, chỉ 45k/tháng là được 100GB rồi. Bạn nào có tài khoản Google Apps miễn phí nữa thì càng tuyệt vời.

    1. Cài đặt Rclone

    Cài đặt với hệ điều hành Linux 64bit

    cd /root/
    wget https://downloads.rclone.org/rclone-current-linux-amd64.zip
    unzip rclone-current-linux-amd64.zip
    \cp rclone-v*-linux-amd64/rclone /usr/sbin/
    rm -rf rclone-*

    2. Tạo kết nối với Goolge Drive

    Quá trình cài đặt hoàn tất thì chạy lệnh
    rclone config
    
    Bạn sẽ nhận được thông báo: No remotes found - make a new one, nhập n rồi nhấn Enter để tạo kết nối mới.

    Ở dòng name bạn nhập remote để đặt tên cho kết nối, bạn có thể chọn tên nào cũng được.

    Một danh sách các dịch vụ cloud xuất hiện, hãy chọn số 13, Google Drive rồi nhấn Enter.

    Ở 2 dòng tiếp theo Client IDClient Secret bạn hãy để trống nhấn Enter.

    Mục Scope that rclone should use when requesting access from drive chọn 1 – drive

    Tiếp theo, để trống với ID of the root folderService Account Credentials JSON file path

    Khi được hỏi Use auto config? hãy nhập n rồi nhấn Enter. Ngay lập tức, Rclone sẽ đưa ra một đường link, bạn có thể click thẳng vào đó hoặc copy rồi paste vào trình duyệt


    Giao diện sẽ xuất hiện như sau:

    Nhấn nút Allow để đồng ý, sau đó bạn sẽ nhận được đoạn mã verification code như hình dưới:

    Quay trở lại cửa sổ SSH, copy rồi paste code này vào dòng Enter verification code> rồi nhấn Enter.

    Chọn n tức no đối với Configure this as a team drive?

    Rclone cần xác nhận thông tin một lần nữa, bạn nhấn y để đồng ý rồi nhấn q để thoát khỏi giao diện cấu hình kết nối.

    Vậy là xong, giờ bạn có thể test với lệnh liệt kê thư mục trong kết nối remote
    # rclone lsd remote:

    3. Tạo file script backup

    Tạo file backup.sh ở thư mục /root/

    nano /root/backup.sh

    Copy toàn bộ nội dung script bên dưới rồi paste vào

    # Partner - Tu dong backup website CyberPanel toi Google Drive
    
    #!/bin/bash
    
    SERVER_NAME=BACKUP_WEB_BY_PARTNER
    
    TIMESTAMP=$(date +"%F")
    BACKUP_DIR="/root/backup/$TIMESTAMP"
    MYSQL=/usr/bin/mysql
    MYSQLDUMP=/usr/bin/mysqldump
    SECONDS=0
    
    mkdir -p "$BACKUP_DIR/mysql"
    
    echo "Starting Backup Database";
    databases=`$MYSQL -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema|performance_schema|mysql)"`
    
    for db in $databases; do
    $MYSQLDUMP --force --opt $db | gzip > "$BACKUP_DIR/mysql/$db.gz"
    done
    echo "Finished";
    echo '';
    
    echo "Starting Backup Website";
    # Loop through /home directory
    for D in /home/*; do
    if [ -d "${D}" ]; then #If a directory
    domain=${D##*/} # Domain name
    echo "- "$domain;
    zip -r $BACKUP_DIR/$domain.zip /home/$domain/public_html/ -q -x /home/$domain/public_html/wp-content/cache/**\* #Exclude cache
    fi
    done
    echo "Finished";
    echo '';
    
    size=$(du -sh $BACKUP_DIR | awk '{ print $1}')
    
    echo "Starting Uploading Backup";
    /usr/sbin/rclone move $BACKUP_DIR "remote:$SERVER_NAME/$TIMESTAMP" >> /var/log/rclone.log 2>&1
    # Clean up
    rm -rf $BACKUP_DIR
    /usr/sbin/rclone -q --min-age 2w delete "remote:$SERVER_NAME" #Remove all backups older than 2 week
    /usr/sbin/rclone -q --min-age 2w rmdirs "remote:$SERVER_NAME" #Remove all empty folders older than 2 week
    /usr/sbin/rclone cleanup "remote:" #Cleanup Trash
    echo "Finished";
    echo '';
    
    duration=$SECONDS
    echo "Total $size, $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."

    Nhấn Ctrl+O, Enter để lưu và Ctrl+X để thoát.

    Phân quyền cho script
    chmod +x /root/backup.sh

    Vậy là xong rồi đó, giờ bạn có thể test lại bằng cách chạy lệnh:
    /root/backup.sh

    Thử kiểm tra trên Cloud xem có thư mục mới với dữ liệu backup chưa nhé, hoặc test với lệnh:
    rclone lsl remote:BACKUP_WEB_BY_PARTNER

    4. Tạo cronjob tự động backup hàng ngày

    Giờ mình sẽ cho script tự động chạy lúc 2h00 sáng.

    EDITOR=nano crontab -e

    Dán nội dung sau vào cửa sổ Terminal

    0 2 * * * /root/backup.sh > /dev/null 2>&1

    Nhấn Ctrl+O, Enter để lưu và Ctrl+X để thoát

    Vậy là xong, cứ 2h sáng hàng ngày script sẽ tự động chạy, backup toàn bộ dữ liệu của VPS rồi upload lên Google Drive. Đồng thời, dữ liệu backup trên VPS sẽ được xóa luôn sau khi upload xong.

    ]]>
    https://partner.com.vn/tu-dong-backup-website-tren-cyberpanel-len-google-drive-su-dung-rclone/feed/ 0
    Khắc phục lỗi “WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED” khi kết nối SSH https://partner.com.vn/khac-phuc-loi-warning-remote-host-identification-has-changed-khi-ket-noi-ssh/ https://partner.com.vn/khac-phuc-loi-warning-remote-host-identification-has-changed-khi-ket-noi-ssh/#respond Sat, 13 Jun 2020 19:30:32 +0000 http://partner.com.vn/?p=320 Khi kết nối ssh nếu gặp lỗi tương tự như sau:

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
    Someone could be eavesdropping on you right now (man-in-the-middle attack)!
    It is also possible that a host key has just been changed.
    The fingerprint for the RSA key sent by the remote host is
    51:82:00:1c:7e:6f:ac:ac:de:f1:53:08:1c:7d:55:68.
    Please contact your system administrator.
    Add correct host key in /Users/partner/.ssh/known_hosts to get rid of this message.
    Offending RSA key in /Users/partner/.ssh/known_hosts:12
    RSA host key for 104.131.16.158 has changed and you have requested strict checking.
    Host key verification failed.
    

    Thì chúng ta gõ lệnh sau để sửa lỗi

    ssh-keygen -R "địa chỉ IP của máy chủ hoặc VPS"
    
    Ví dụ: ssh-keygen -R "103.199.18.155"
    ]]>
    https://partner.com.vn/khac-phuc-loi-warning-remote-host-identification-has-changed-khi-ket-noi-ssh/feed/ 0
    Say Salut to Essentials theme https://partner.com.vn/say-salut-to-the-most-advanced-theme/ https://partner.com.vn/say-salut-to-the-most-advanced-theme/#respond Sat, 15 Feb 2020 03:01:41 +0000 https://essentials.pixfort.com/original/?p=1265 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

    It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using ‘Content here, content here’, making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for ‘lorem ipsum’ will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).

    This is a simple text

    Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of “de Finibus Bonorum et Malorum” (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, “Lorem ipsum dolor sit amet..”, comes from a line in section 1.10.32.

    Get the most advanced WordPress theme.

    The wait is over. Design better and spend less time without restricting creative freedom. Combine seamlessly fitting layouts, customize everything.

    The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from “de Finibus Bonorum et Malorum” by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.

    ]]>
    https://partner.com.vn/say-salut-to-the-most-advanced-theme/feed/ 0
    It’s time to say Hello to Essentials theme https://partner.com.vn/its-time-to-say-hello-to-essentials-theme/ https://partner.com.vn/its-time-to-say-hello-to-essentials-theme/#respond Sat, 15 Feb 2020 01:09:55 +0000 https://essentials.pixfort.com/original/?p=1217 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

    It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using ‘Content here, content here’, making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for ‘lorem ipsum’ will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).

    This is a simple dummy audio file
    This is a simple text

    Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of “de Finibus Bonorum et Malorum” (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, “Lorem ipsum dolor sit amet..”, comes from a line in section 1.10.32.

    Get the most advanced WordPress theme.

    The wait is over. Design better and spend less time without restricting creative freedom. Combine seamlessly fitting layouts, customize everything.

    The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from “de Finibus Bonorum et Malorum” by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.

    ]]>
    https://partner.com.vn/its-time-to-say-hello-to-essentials-theme/feed/ 0
    Create any website like a pro https://partner.com.vn/create-fast-and-cool-websites-like-a-pro/ https://partner.com.vn/create-fast-and-cool-websites-like-a-pro/#respond Fri, 14 Feb 2020 03:09:18 +0000 https://essentials.pixfort.com/original/?p=1212 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

    It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using ‘Content here, content here’, making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for ‘lorem ipsum’ will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).

    This is a simple text

    Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of “de Finibus Bonorum et Malorum” (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, “Lorem ipsum dolor sit amet..”, comes from a line in section 1.10.32.

    Get the most advanced WordPress theme.

    The wait is over. Design better and spend less time without restricting creative freedom. Combine seamlessly fitting layouts, customize everything.

    The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from “de Finibus Bonorum et Malorum” by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.

    ]]>
    https://partner.com.vn/create-fast-and-cool-websites-like-a-pro/feed/ 0
    Add languages to your website https://partner.com.vn/add-multiple-languages-to-your-site/ https://partner.com.vn/add-multiple-languages-to-your-site/#respond Fri, 14 Feb 2020 02:39:53 +0000 https://essentials.pixfort.com/original/?p=1208 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

    It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using ‘Content here, content here’, making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for ‘lorem ipsum’ will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).

    This is a simple text

    Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of “de Finibus Bonorum et Malorum” (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, “Lorem ipsum dolor sit amet..”, comes from a line in section 1.10.32.

    Get the most advanced WordPress theme.

    The wait is over. Design better and spend less time without restricting creative freedom. Combine seamlessly fitting layouts, customize everything.

    The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from “de Finibus Bonorum et Malorum” by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.

    ]]>
    https://partner.com.vn/add-multiple-languages-to-your-site/feed/ 0
    Hello world, this is Essentials theme https://partner.com.vn/hello-world-this-is-essentials-theme/ https://partner.com.vn/hello-world-this-is-essentials-theme/#respond Mon, 13 Jan 2020 23:04:08 +0000 https://essentials.pixfort.com/startup/?p=3106 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

    It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using ‘Content here, content here’, making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for ‘lorem ipsum’ will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).

    This is a simple text

    Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of “de Finibus Bonorum et Malorum” (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, “Lorem ipsum dolor sit amet..”, comes from a line in section 1.10.32.

    Get the most advanced WordPress theme.

    The wait is over. Design better and spend less time without restricting creative freedom. Combine seamlessly fitting layouts, customize everything.

    The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from “de Finibus Bonorum et Malorum” by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.

    ]]>
    https://partner.com.vn/hello-world-this-is-essentials-theme/feed/ 0