To see information about a package, run
apt-cache showpkg PKG_NAME
To see information about a package, run
apt-cache showpkg PKG_NAME
To find dependencies for a package, run
apt-cache depends PACKAGE_NAME
Example
root@ubuntu-s-4vcpu-8gb-nyc1-01:~# apt-cache depends php7.2 php7.2 |Depends: libapache2-mod-php7.2 |Depends: php7.2-fpm Depends: php7.2-cgi Depends: php7.2-common root@ubuntu-s-4vcpu-8gb-nyc1-01:~#
In above example, when you install php7.2, it install “libapache2-mod-php7.2”, that will install Apache web server. I had a server with ngtinx, when i install php7.2 package, apache get installed.
You can also use
apt depends PACKAGE_NAME
To find reverse dependency, run
apt-cache rdepends PACKAGE_NAME
When i add a key with apt-key command, i get error
root@ip-172-31-47-128:~# apt-key adv –recv-keys –keyserver keys.gnupg.net E1F958385BFE2B6E
Executing: /tmp/apt-key-gpghome.0BP6Ro2t54/gpg.1.sh –recv-keys –keyserver keys.gnupg.net E1F958385BFE2B6E
gpg: failed to start the dirmngr ‘/usr/bin/dirmngr’: No such file or directory
gpg: connecting dirmngr at ‘/tmp/apt-key-gpghome.0BP6Ro2t54/S.dirmngr’ failed: No such file or directory
gpg: keyserver receive failed: No dirmngr
root@ip-172-31-47-128:~#
To fix this, run
apt -y install dirmngr
Once installed, apt-key command worked properly.
root@ip-172-31-47-128:~# apt-key adv –recv-keys –keyserver keys.gnupg.net E1F958385BFE2B6E
Executing: /tmp/apt-key-gpghome.BLNQkuFGIQ/gpg.1.sh –recv-keys –keyserver keys.gnupg.net E1F958385BFE2B6E
gpg: key E1F958385BFE2B6E: public key “X2go Debian/Ubuntu Packaging” imported
gpg: Total number processed: 1
gpg: imported: 1
root@ip-172-31-47-128:~#
To install and use Linux remote server as desktop, first install lite weight desktop environment like XFCE on your server.
apt update apt install xfce4 -y
Install XRDP
apt install xrdp
You need to create a user to be used for desktop.
useradd -m -s /bin/bash desktop
Set password for the user
passwd desktop
Now login as this user and create .xsession file.
su - desktop echo xfce4-session >~/.xsession
Exit out of this user
exit
Restart XRDP
service xrdp restart
Now you will be able to connect to this server with any RDP client like you connect to Windows Server (Windows Remote Desktop).
When I install Debian 9 from CD, it did install with /etc/apt/sources.list pointing to CD.
To get this work properly, you need to edit the file
vi /etc/apt/sources.list
Replace content with
deb http://security.debian.org/ stretch/updates main deb-src http://security.debian.org/ stretch/updates main deb http://ftp.debian.org/debian/ stretch-updates main deb-src http://ftp.debian.org/debian/ stretch-updates main deb http://ftp.us.debian.org/debian stable main contrib non-free
Monit can be used to monitor services, restart them if required. To install monit, run
apt -y install monit
To start monit, run
systemctl start monit
Monitor Apache
vi /etc/monit/conf-available/apache2-custom
Add
check process apache with pidfile /var/run/apache2/apache2.pid group www-data start program = "/etc/init.d/apache2 start" stop program = "/etc/init.d/apache2 stop" if failed host localhost port 80 protocol http then restart if 5 restarts within 5 cycles then timeout
Activate the rule with
ln -s /etc/monit/conf-available/apache2-custom /etc/monit/conf-enabled/apache2-custom
Restart monit with
systemctl restart monit
Testing If Monit works
Open 2 terminals. On one, tail the monit logs with
tail -f /var/log/monit.log
On other terminal, stop Apache
service apache2 stop
Within 2 minutes, monit will restart apache web server.
Download latest version of ionCube loader from
cd /usr/local/src wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz tar xvf ioncube_loaders_lin_x86-64.tar.gz cd ioncube/
Check PHP version with
php -v
On Debian 9, default will be PHP 7.0, so you need to use file ioncube_loader_lin_7.0.so
Find PHP extension_dir, this is where you need to put PHP extensions.
root@ip-172-31-44-173:/usr/local/src/ioncube# php -i | grep extension_dir extension_dir => /usr/lib/php/20151012 => /usr/lib/php/20151012 root@ip-172-31-44-173:/usr/local/src/ioncube#
Copy the file to extension directory
cp /usr/local/src/ioncube/ioncube_loader_lin_7.0.so /usr/lib/php/20151012
Enable ionCube loader with
echo "zend_extension=ioncube_loader_lin_7.0.so" > /etc/php/7.0/mods-available/ioncube.ini ln -s /etc/php/7.0/mods-available/ioncube.ini /etc/php/7.0/cli/conf.d/01-ioncube.ini ln -s /etc/php/7.0/mods-available/ioncube.ini /etc/php/7.0/apache2/conf.d/01-ioncube.ini
Now php -m will show ioncube
root@ip-172-31-44-173:~# php -m | grep ion ionCube Loader Reflection session the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) root@ip-172-31-44-173:~#
Restart apache
service apache2 restart
To install GeoIP php module in Ubuntu, run
apt install php-geoip
To enable module, run
phpenmod geoip
You can see the PHP module with command php -m
root@ip-172-31-26-233:~# php -m | grep geoip geoip root@ip-172-31-26-233:~#
Also it will be listed in phpinfo page.
To install pure-ftpd on Ubuntu, run
apt install pure-ftpd -y
Create a system user
useradd -d /var/www -s /bin/bash USERNAME chown -R USERNAME:USERNAME /var/www passwd USERNAME
To allow system user to login using FTP, edit file
vi /etc/pure-ftpd/pure-ftpd.conf
Uncomment the line
UnixAuthentication yes
Or
echo 'yes' > /etc/pure-ftpd/conf/UnixAuthentication
On Ubuntu, after default install, you have following settins.
root@server:/etc/pure-ftpd/auth# ll total 8 drwxr-xr-x 2 root root 4096 Jan 28 05:52 ./ drwxr-xr-x 5 root root 4096 Jan 28 06:20 ../ lrwxrwxrwx 1 root root 26 Feb 5 2018 65unix -> ../conf/UnixAuthentication lrwxrwxrwx 1 root root 25 Feb 5 2018 70pam -> ../conf/PAMAuthentication root@server:~# cat /etc/pure-ftpd/auth/65unix no root@server:~# cat /etc/pure-ftpd/auth/70pam yes root@server:~#
PAMAuthentication enabled. UnixAutehticiation disabled. This allow system users to login using PAM.
To force delete a package, run
dpkg --purge --force-depends PKG_NAME
List all Installed packages
dpkg -l
List all files in a package
dpkg -L PKG_NAME
To find which package provides a file
dpkg -S /usr/bin/nmap