On web hosting servers such as Xserver or Lolipop rental servers where root privileges sudo command or sudo apt install command cannot be used, you can manually install packages using packaged files - .deb files for Ubuntu-based systems or .rpm packages for CentOS-based systems.
<>
.deb files and .rpm files are usually placed on Github release pages and similar locations. They can be thought of as similar to .exe or .msi installation executable files in Windows.
sudo, we’ll use such package files directly to perform the installation.
Convert packages using alien. Convert the downloaded deb package to an rpm package.
As an example, here are the steps to install “croc”, an open-source file transfer program, on Xserver, a CentOS-based web hosting server.
You can check released executable files and source files from the following. Look for .deb or .rpm files.
Look for a .rpm file for CentOS. It doesn’t seem to be listed here. The “croc_8.6.7_Linux-64bit.deb” file is a package file for Ubuntu-based systems. Package files like .deb and .rpm can be converted to each other using a program called “alien” described later. Let’s download an appropriate package file.
Since we need to convert the package file using alien in this case, we’ll do this work in the local environment. Then, we’ll transfer the generated .rpm file to the web hosting server. If alien can be installed on the web hosting server or is already installed, this step is not necessary.
<>
wget https://github.com/schollz/croc/releases/download/v8.6.7/croc_8.6.7_Linux-64bit.deb # [Release v8.6.7 · schollz/croc](https://github.com/schollz/croc/releases/tag/v8.6.7)
Install alien, a tool for converting package files to each other.
sudo apt update ; sudo apt install alien -y
Convert and generate the .deb file to an .rpm package file.
sudo alien -r croc_8.6.7_Linux-64bit.deb # or alien --rpm
Transfer the rpm file to the server.
It's good to use ftp or rsync for transfer.
Recursively Upload Folders and Files to Remote Server via SSH Using rsync
(Example)
rsync -e 'ssh -p 10022 -i ~/.ssh/user.key' -r "croc-8.6.7-2.x86_64.rpm" [email protected]:/home/user
Manually install the transferred rpm package without root privileges. Install the package without sudo privileges using CentOS’s built-in rpm2cpio command.
rpm2cpio croc-8.6.7-2.x86_64.rpm | cpio -idv
If cpio is not installed on the web hosting server, it can also be installed manually. This is introduced at the following link.
Installing cpio on a Web Hosting Server
Verify the package installation.
$ type croc
croc is /usr/local/bin/croc