This topic describes how to install a Cloud Paralleled File System (CPFS) agent on Ubuntu, CentOS, or Alibaba Cloud Linux, and how to mount a CPFS file system.

Background information

POSIX-based APIs are available for CPFS file systems. You can use one or more of these APIs to mount a CPFS file system. You can install custom CPFS agents in CentOS, Ubuntu, or Alibaba Cloud Linux.
CPFS file systems support the following versions of operating systems:
  • CentOS 7.6 and CentOS 7.7
  • Ubuntu 16.04 and Ubuntu 18.04
  • Alibaba Cloud Linux 2

Before you begin

You can install a CPFS agent in CentOS, Ubuntu or, Alibaba Cloud Linux. Before you install CPFS, complete the required preparations.

  • If you want to install a CPFS agent in CentOS or Alibaba Cloud Linux, complete the following preparations:
    1. Install the following packages: make, gcc, libyaml-devel, libtool, zlib-devel, glibc-headers, dkms and, expect.
      yum install -y make gcc libyaml-devel libtool zlib-devel glibc-headers dkms expect
    2. Install the kernel-devel package.
      yum install -y kernel-devel-`uname -r`
      Note
      • You must ensure that the version of the kernel-devel package that you want to install is the same as that of the kernel.
      • If the versions of all kernel-devel packages in a yum repository are different from the kernel version, you can run the uname -r command to verify the kernel version. Then, you can visit the Official CentOS website to download the required kernel-devel package.
  • If you want to install a CPFS agent in Ubuntu, complete the following preparations:
    1. Verify that Kernel Headers is installed.
      dpkg -l | grep 'linux-headers'  |grep `uname -r`

      If the version number of the linux-headers package is returned, it indicates that the kernelheader tool is installed.

    2. Update the dkms package.
      apt-get update
      apt-get install -y dkms
    3. Install dependencies.
      apt-get install -y libyaml-dev libsnmp-dev

      If the message The following packages have unmet dependencies is returned, run the apt --fix-broken install command to fix the issue.

    4. Uninstall Lustre-related packages.

      If Lustre is installed, run the following commands to uninstall Lustre:

      dpkg -l | grep lustre
      dpkg -e <lustre pkg>

      After Lustre is uninstalled, use the following command to check whether the lustre directory exists:

      ls /lib/modules/`uname -r`/kernel/drivers/staging/lustre

      If the directory exits, run the mv /lib/modules/`uname -r`/kernel/drivers/staging/lustre ~/backup command to delete the directory.

CentOS and Alibaba Cloud Linux

  1. Run the following command to download a CPFS agent.
    • If you use CentOS, run the following command:
      wget https://cpfs-client.oss-cn-beijing.aliyuncs.com/centos/cpfs-client-latest.el7.tar.gz
    • If you use Alibaba Cloud Linux, run the following command:
      wget https://cpfs-client.oss-cn-beijing.aliyuncs.com/aliyunos/cpfs-client-latest.al7.tar.gz
  2. Install the CPFS client.
    • If you are using CentOS, run the following commands:
      tar -zxvf cpfs-client-latest.el7.tar.gz
      rpm -ivh cpfs-client-dkms-*.el7.noarch.rpm
      rpm -ivh cpfs-client-2.10.8-*.el7.x86_64.rpm
    • If you are using Alibaba Cloud Linux, run the following commands:
      tar -zxvf cpfs-client-latest.al7.tar.gz
      rpm -ivh cpfs-client-dkms-*.al7.noarch.rpm
      rpm -ivh cpfs-client-2.10.8-*.al7.x86_64.rpm
    After the CPFS agent is installed, you can run the dkms status command to view the status. If a WARNING message is returned from the dkms status command, run the following command to fix this issue:
    mkdir ~/cpfs-backup
    mv /lib/modules/`uname -r`/kernel/drivers/staging/lustre ~/cpfs-backup
    dkms uninstall cpfs-client/1.0.0
    dkms remove cpfs-client/1.0.0 --all
    lustre_rmmod
    rmmod libcfs
    rmmod lnet
    dkms build cpfs-client/1.0.0
    dkms install cpfs-client/1.0.0
    If the WARNING message is still returned from the command, contact Alibaba Cloud technical support for further assistance.
  3. Run the vim /etc/cpfs/cpfs-mounts.conf command to edit the cpfs-mounts.conf configuration file. Add the following information to the configuration file. The information specifies the file system and the local directory on which you want to mount the file system.
    cpfs-xxx.cn-shanghai.cpfs.nas.aliyuncs.com@tcp:cpfs-xxx.cn-shanghai.cpfs.nas.aliyuncs.com@tcp:/xxx /mnt localflock
    Note
    • When you mount a file system, you can select multiple mount options. These mount options are separated by commas (,). For example, you can select the following options:
      • localflock: If an application needs to run the flock command to lock files, you must select localflock as a mount option.
      • noatime: If an application is insensitive to access timestamps, you can select noatime to improve read/write performance of the file system.
    • In the configuration file, each line contains the information of a mount target for a file system and a local directory on which you want to mount the file system. You can obtain the details of a mount target from the Apsara File Storage NAS console and specify a local directory on which you want to mount a file system. In most cases, the local directory is a subdirectory of the /mnt directory.
  4. Run the service cpfs-client start command to start the CPFS service.
    Note
    • To view the status of the CPFS service, you can run the service cpfs-client status command.
    • To stop the CPFS service, you can run the service cpfs-client stop command.
    • If you no longer use CPFS, you can run the service cpfs-client stop command to stop the CPFS service on the associated Elastic Compute Service (ECS) instance. Then, you can run the rpm -e cpfs-client and rpm -e cpfs-client-dkms commands to uninstall the CPFS agent.

Ubuntu

  1. Download the installation package from the official website.
    • If you are using Ubuntu 16.04, run the following command to decompress the package:
      wget https://cpfs-client.oss-cn-beijing.aliyuncs.com/ubuntu/cpfs-client-ubuntu1604_amd64_latest.tar.gz
    • If you are using Ubuntu 18.04, run the following command to decompress the package.
      wget https://cpfs-client.oss-cn-beijing.aliyuncs.com/ubuntu/cpfs-client-ubuntu1804_amd64_latest.tar.gz
  2. Decompress the package.
    • If you are using Ubuntu 16.04, run the following command to decompress the package:
      tar -xf cpfs-client-ubuntu1604_amd64_latest.tar.gz
    • If you are using Ubuntu 18.04, run the following command to decompress the package:
      tar -xf cpfs-client-ubuntu1804_amd64_latest.tar.gz
  3. Run the following command to install the cpfs-client-dkms package:
    dpkg -i cpfs-client-dkms_*_amd64.deb
    After the package is installed, run the dkms status command to view the status. If a WARNING message is returned from the dkms status command, you can run the following command to fix the issue:
    mkdir ~/cpfs-backup
    mv /lib/modules/`uname -r`/kernel/drivers/staging/lustre ~/cpfs-backup
    dkms uninstall cpfs-client/1.0.0-204
    dkms remove cpfs-client/1.0.0-204 --all
    lustre_rmmod
    rmmod libcfs
    rmmod lnet
    dkms build cpfs-client/1.0.0-204
    dkms install cpfs-client/1.0.0-204
    If the WARNING message is still returned from the command, contact Alibaba Cloud technical support for further assistance.
  4. Run the following command to install the cpfs-client package:
    dpkg -i cpfs-client_*_amd64.deb
  5. Run the vim /etc/cpfs/cpfs-mounts.conf command to edit the cpfs-mounts.conf configuration file. Add the following information to the configuration file. The information specifies the file system and the local directory on which you want to mount the file system.
    cpfs-xxx.cn-shanghai.cpfs.nas.aliyuncs.com@tcp:cpfs-xxx.cn-shanghai.cpfs.nas.aliyuncs.com@tcp:/xxx /mnt localflock
    Note
    • When you mount a file system, you can select multiple mount options. These mount options are separated by commas (,). For example, you can select the following options:
      • localflock: If an application needs to run the flock command to lock files, you must select localflock as a mount option.
      • noatime: If an application is insensitive to access timestamps, you can select noatime to improve read/write performance of the file system.
    • In the configuration file, each line contains the information of a mount target for a file system and a local directory on which you want to mount the file system. You can obtain the details of a mount target from the Apsara File Storage NAS console and specify a local directory on which you want to mount a file system. In most cases, the local directory is a subdirectory of the /mnt directory.
  6. Run the service cpfs-client start command to start the CPFS service.
    Note
    • To view the status of the CPFS service, you can run the service cpfs-client status command.
    • To stop the CPFS service, you can run the service cpfs-client stop command.
    • If you no longer use CPFS, you can run the service cpfs-client stop command to stop the CPFS service on the associated Elastic Compute Service (ECS) instance. Then, you can run the rpm -e cpfs-client and rpm -e cpfs-client-dkms commands to uninstall the CPFS agent.