Table of Contents

Remote package manager

Package management on Linux systems is an important task, but sometimes can be complex due to variety of tools used for that purpose by various distributions. These tools have different names and are used slightly differently. For example, on Debian based distributions the apt toolset is used, while most RedHat based distributions use the yum tool. SUSE Linux has zypper, Mandrake derived distributions (Mandriva, Mageia) use urpm tools, Arch Linux has pacman, FreeBSD has pkg, etc. There are lots of varying GUI tools for package management as well.

For software developers working with multiple Linux/Unix installations to develop and test their software, all this mess with package management makes the process unnecessarily awkward. To address this, WinGDB offers the universal package manager, integrated into Visual Studio as a document window.

The package manager offers the following features:

Using the package manager

In order to open new package manager window, you have to configure a connection first. This is done in the same way as for Remote terminal facility. Choose Open remote shell... option from WinGDB main menu to open the connection manager. Inside the connection manager, you can choose the connection you want to open. You can also add or remove connections, or edit their parameters.

Remote terminal manager

Clicking New session or Edit session buttons opens a dialog allowing you to edit the parameters. The most basic parameters are connection name, target host name (or address), port (defaults to standard SSH port equal to 22) user account name and password. The password is optional. If you specify it, the password will be stored in encrypted form and not shown explicitly on screen. You will not have to enter it every time when opening the connection. You can also leave this field empty for even more security. WinGDB will then ask you for a password when connecting. You will also have an option to use Agent authentication method. The latter one is described here.

Edit remote terminal session

In order to open the package manager for chosen connection, right-click on the connection and choose Package manager option from the menu.

Depending on the system and configuration, you might need to wait some time (up to ca. one minute, depends on network speed), as WinGDB runs the package management tool on the remote side to download the list of available packages. For most distributions it is quite fast, but for RedHat based distros using yum tool we have observed some delay. WinGDB caches information downloaded from remote repositories, therefore next time when you open the package manager for same host, it will open much faster.

Also for some systems you may be prompted for the root password. This is required by underlying package managers on remote systems -- you must be root to install or remove packages. The root password entered here is not stored by WinGDB and is being remembered only for the duration of the session.

When loaded, the package list looks like below. You can view most important information about packages. For some back ends, some columns may be empty due to information not available. Click on column headers to sort.

Filtering packages

You can apply filters to arbitrary number of columns. A filter on a column allows display only of those packages, which have the value in particular column containing the string specified as filter. For example, you can enter gcc in the Name column and 4.6 as the Version for the following result:

Double-click a field in the filters row to edit the filter. Enter empty filter to stop filtering on the column. You can also add a filter to the Status column. This particular column displays also overall count of shown packages.

Installing and uninstalling packages

In order to install an Available package, click on the corresponding row, right-click and from the menu choose Install. In the same way you can uninstall an Installed package (choose Uninstall from the menu).

WinGDB issues appropriate install/uninstall command to the back end. Required dependencies will be automatically installed. In order to view he progress of the installation and other messages (including possible errors), open Output/WinGDB build window.

Listing package contents

You can list files belonging to an installed package by right-clicking on it and choosing the List package files option. The file list will be printed in the Output window, on WinGDB build page.

Prerequisites and preparation

In order to use the remote package manager, the system must allow administrator logins over SSH in one of these forms:

Also, for most setups, external Internet connection will be needed, because distributions download packages from central repositories. You can avoid this by installing your distribution from CD-ROM or using local repository over FTP (details depend on particular OS distribution).

Setting up SSH

The first requirement is SSH setup on the target host. Details how to install and configure it vary among distributions. For most of them, you will have to log in locally as root. For typical Ubuntu-based distributions you will use sudo instead.

RedHat based distributions (RHEL, Fedora, CentOS)

To install sshd, type the following command:

yum install openssh-server

To enable and start sshd, type the following commands:

systemctl enable sshd.service
systemctl start sshd.service

Ubuntu based distributions (Ubuntu, Mint)

To install sshd, type the following command (as non-root user):

sudo apt-get install openssh-server

The above command should start sshd server automatically. In order to restart it (e.g. after modifying its configuration file), type command:

sudo service ssh restart

Mandrake based distributions (Mandriva, Mageia)

To install sshd, type the following command:

urpmi openssh-server

To start the service, type command:

service sshd start

To ensure SSH is started on boot, type command:

chkconfig sshd on

Arch based distributions (Arch, Manjaro)

To install sshd, type the following command:

pacman -S openssh

To enable and start sshd, type the following commands:

systemctl enable sshd
systemctl start sshd

SUSE based distributions

You can enable sshd during system installation, or later using the following commands:

systemctl enable sshd.service
systemctl start sshd.service

In case openssh package is not installed on your system, install it with command:

zypper install openssh

FreeBSD

Please follow instructions on the FreeBSD documentation page.

Setting up remote user login with administrative rights

Ubuntu based distributions (Ubuntu, Mint)

Those distributions come with preconfigured sudo and no further action is required. WinGDB will login as ordinary user and use sudo to elevate the privileges.

RedHat based distributions (RHEL, Fedora, CentOS)

For those distributions, sudo is optional and might be (or not) configured on your system. Enter ordinary user credentials when configuring the connection. WinGDB will try all three methods on login. First, it will use sudo with ordinary user password. If it does not work, it will ask you for root password (not stored anywhere, remembered only temporarily) and use su command to elevate privileges. If this does not work, WinGDB will try just to connect as root user. You can avoid all that process by entering root user and root password when configuring the connection -- although this is less secure.

You can avoid logging in as root by allowing an ordinary user on your system to use sudo. To do this, log in as root and add the user to the wheel group with command:

usermod [username] -a -G wheel

On older distros, this might be not sufficient. Edition of the /etc/sudoers file with special visudo command is required in such case. Please find instructions on respective distribution documentation pages or wikis.

Remote login as root

Another option (when sudo is not available or you do not want to use it) is supplying root password. However, remote system still may refuse to accept the login because of configuration.

OpenSSH server configuration

You can enable remote root logins by editing the following file:

/etc/ssh/sshd_config

Find the line containing PermitRootLogin directive. Depending on particular system and distro, it might be commented out, set to any value other than yes, or not present at all. Usually, by default it is commented out:

#PermitRootLogin no

Make sure that the directive is present, not commented and set to yes:

PermitRootLogin yes

When you finish editing, restart sshd server using one of the commands listed above, appropriate for your distro, e.g.:

systemctl restart sshd.service

Allowing remote login as root is fairly secure as long as the machine is used only in an internal network, protected by a firewall. It is perfectly secure if this is a virtual machine configured to work with Host only virtual network (e.g. in VirtualBox).

Do not enable remote root login if your machine is connected directly to Internet (with an external IP address) or insecure network.


Copyright (C) 2008-2016 SOFT-ERG. All rights reserved.