This page shows how to prepare an x86_64 machine as an external service. 



0. System required:

  1. Linux distribution: Ubuntu LTS 18.04.06 only
  2. Support Services:  CEPH RGW/MDS, RBD, RBD-NBD, Docker container
  3. Local registry service usually running on the first build MON, user can log in to mon node and run docker ps to check if there has service named 'registry' with image name 'registry:2' or prepare custom private registry server for CEPH service.


1.  Download the packages file and upload it to the external host.

ext-host-20220223v2.tar.gz 


2. Extract the tar file

sudo tar -pxmf ./ext-host-20220223v2.tar.gz -C /opt/



3. Install packages

for dir in 01.ceph 02.pre-docker 03.docker 05.nfs 06.proftpd 07.samba 08.zabbix 09.iscsi 10.kernel ;do
cd "/opt/pkgs/${dir}"
sudo dpkg -i --force-all *.deb
done
sudo cp /opt/pkgs/chkprimary /usr/local/bin/
cat << EOF |sudo tee /lib/systemd/system/target.service
[Unit]
Description=Restore LIO kernel target configuration
Requires=sys-kernel-config.mount
After=sys-kernel-config.mount network.target local-fs.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/targetctl restore
ExecStop=/usr/bin/targetctl clear
SyslogIdentifier=target

[Install]
WantedBy=multi-user.target
EOF
sudo cp /opt/pkgs/ambedded_sv.sh /usr/local/bin/
sudo cp /opt/pkgs/ambnfs.service /etc/systemd/system
sudo systemctl daemon-reload
sudo ln -s -f  rtslib-fb-target /etc/target
sudo systemctl enable --now target



4. Run docker load -i tar file to import docker images.

mv /opt/pkgs/4.docker-tarball /var/lib/docker/amb-image
cd /var/lib/docker/amb-image
docker load -i ceph.tar.gz



5. Copy daemon json from mars400


registry_host="10.240.82.228"
scp root@${registry_host}:/etc/docker/daemon.json /etc/docker/daemon.json
systemctl restart docker
docker pull "${registry_host}:5000/ceph:arm64-v16"



6. add x86 container image to the registry server

registry_ceph_x86="10.240.82.228:5000/ceph:amd64-v16"
docker tag ceph/ceph:amd64-v16 "${registry_ceph_x86}"
docker push "${registry_ceph_x86}"


7. Create a manifest to combine the different arch.

registry_host="10.240.82.228"
registry_target="10.240.82.228:5000"
docker manifest create --insecure \
"${registry_target}/ceph:v16" \
--amend "${registry_target}/ceph:amd64-v16" \
--amend "${registry_target}/ceph:arm64-v16"
sha=$(docker manifest push --insecure "${registry_target}/ceph:v16")
ssh "${registry_host}" "ceph config set global container_image ${registry_target}/ceph@${sha}"
docker pull "${registry_target}/ceph:v16
docker rmi "${registry_target}/ceph:arm64-v16" \
    "${registry_target}/ceph:amd64-v16" \
     "ceph/ceph:amd64-v16



11. Check cephadm version report is ok

cephadm version
Using recent ceph image 10.240.82.228:5000/ceph@sha256:3fb1c1f91539a61982ed82111459649a684e6a26dc65342ab649a25cd5e5fcfc
ceph version 16.2.5 (0883bdea7337b95e4b611c768c0279868462204a) pacific (stable)




Options:


12. Add NFS Service

echo "/data *(rw,no_root_squash,no_subtree_check)" >> /etc/exportfs
systemctl enable --now nfs-server


13. Add Samba Service

cd /etc/samba
cp smb.conf smb.conf.default
diff smb.conf.default smb.conf
50c50
< ; interfaces = 127.0.0.0/8 eth0
---
> interfaces = 192.168.192.0/18 ens18
260a261,266
> [samba-rbd]
> comment = Ambedded RBD share
> path = /data
> guest ok = yes
> browseable = yes
> writable = yes
sudo systemctl stop smbd nmbd
sudo systemctl enable --now smbd nmbd


14. Add SFTP 

cat << EOF |sudo tee /etc/proftpd/conf.d/sftp.conf
<IfModule mod_sftp.c>
        SFTPEngine on
        Port 2222
        UseIPv6 off
        DefaultRoot /data
        User proftpd
        Group nogroup
        Umask 077 077
        SFTPLog /var/log/proftpd/sftp.log
        # Configure both the RSA and DSA host keys, using the same host key
        # files that OpenSSH uses.
        SFTPHostKey /etc/ssh/ssh_host_rsa_key
        SFTPAuthMethods password
        # SFTPAuthorizedUserKeys file:/etc/proftpd/authorized_keys/%u
        # Enable compression
        SFTPCompression delayed
</IfModule>
EOF

sudo cp /etc/proftpd/proftpd.conf /etc/proftpd/proftpd.conf.default
 diff /etc/proftpd/proftpd.conf.default /etc/proftpd/proftpd.conf
11c11
< UseIPv6                               on
---
> UseIPv6                               off
15c15
< ServerName                    "Debian"
---
> ServerName                    "Ambedded FTP Server"
29,30c29,30
< DisplayLogin                    welcome.msg
< DisplayChdir                  .message true
---
> #DisplayLogin                    welcome.msg
> #DisplayChdir                 .message true
75c75
< Umask                         022  022
---
> Umask                         077  077
sudo systemctl enable --now proftpd