Mastering Linux System Administration. Richard Blum

Чтение книги онлайн.

Читать онлайн книгу Mastering Linux System Administration - Richard Blum страница 25

Mastering Linux System Administration - Richard Blum

Скачать книгу

apt --names-only search zsh Sorting… Done Full Text Search… Done fizsh/focal,focal 1.0.9-1 all Friendly Interactive ZSHell zsh/focal 5.8-3ubuntu1 amd64 shell with lots of features zsh-antigen/focal,focal 2.2.3-2 all manage your zsh plugins zsh-autosuggestions/focal,focal 0.6.4-1 all Fish-like fast/unobtrusive autosuggestions for zsh zsh-common/focal,focal 5.8-3ubuntu1 all architecture independent files for Zsh zsh-dev/focal 5.8-3ubuntu1 amd64 shell with lots of features (development files) zsh-doc/focal,focal 5.8-3ubuntu1 all zsh documentation - info/HTML format zsh-static/focal 5.8-3ubuntu1 amd64 shell with lots of features (static link) zsh-syntax-highlighting/focal,focal 0.6.0-3 all Fish shell like syntax highlighting for zsh zsh-theme-powerlevel9k/focal,focal 0.6.7-2 all powerlevel9k is a theme for zsh which uses powerline fonts zshdb/focal,focal 1.1.2-1 all debugger for Z-Shell scripts $

      Once you find the package you'd like to install, installing it using apt is as easy as this:

      Since installing new software requires root privileges, you must use the sudo command in Ubuntu. The output will show basic information about the package and ask if you want to proceed with the installation.

      image Real World Scenario

      INSTALLING SOFTWARE USING APT

      Using the apt command makes installing software in Ubuntu easy. In this exercise, you'll install the Z shell on your Ubuntu server.

      1 Log into your Linux system as the sysadmin account created in Chapter 2, “Installing an Ubuntu Server.”

      2 From the command prompt, enter the command sudo apt install zsh. The sudo command is required to allow your user to run the apt command with root user privileges. Enter your user password when prompted. You should see something similar to this output: [sudo] password for sysadmin: Reading package lists… Done Building dependency tree Reading state information… Done The following additional packages will be installed: zsh-common Suggested packages: zsh-doc The following NEW packages will be installed: zsh zsh-common 0 upgraded, 2 newly installed, 0 to remove and 56 not upgraded. Need to get 4,450 kB of archives. After this operation, 18.0 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://us.archive.ubuntu.com/ubuntu focal/main amd64 zsh-common all 5.8-3ubuntu1 [3,744 kB] Get:2 http://us.archive.ubuntu.com/ubuntu focal/main amd64 zsh amd64 5.8-3ubuntu1 [707 kB] Fetched 4,450 kB in 4s (1,039 kB/s) Selecting previously unselected package zsh-common. (Reading database … 179515 files and directories currently installed.) Preparing to unpack …/zsh-common_5.8-3ubuntu1_all.deb … Unpacking zsh-common (5.8-3ubuntu1) … Selecting previously unselected package zsh. Preparing to unpack …/zsh_5.8-3ubuntu1_amd64.deb … Unpacking zsh (5.8-3ubuntu1) … Setting up zsh-common (5.8-3ubuntu1) … Setting up zsh (5.8-3ubuntu1) … Processing triggers for man-db (2.9.1-1) … $

      3 Test the install by entering the command zsh. You will see a menu prompting if you want to customize your Z shell environment. Enter 0 to use the default configuration. You should then get the Z shell prompt. ubuntu-server%

      4 Return to your normal Bash Shell by typing the command exit.

      5 Check whether the installation processed properly, type the command apt ‐‐installed list. You should see the package appear, indicating that it is installed.

      When installing a package, apt will ask to install other packages as well. This is because apt automatically resolves any necessary package dependencies for us and installs the needed additional library and software packages. This is a wonderful feature included in many package management systems.

      Upgrading Software with apt

      While apt helps protect you from problems installing software, trying to coordinate a multiple‐package update with dependencies can get tricky. To safely upgrade all the software packages on a system with any new versions in the repository, use the upgrade command (again, using sudo to obtain root privileges).

      sudo apt upgrade

      Notice that this command doesn't take any software package names as an argument. That's because the upgrade option will upgrade all the installed packages to the most recent version available in the repository, which is safer for system stabilization.

      In the Figure 3.1 output, notice that apt lists the packages that will be upgraded, but also any new packages that are required to be installed because of upgrades.

      The upgrade command won't remove any packages as part of the upgrade process. If a package needs to be removed as part of an upgrade, use the following command:

      sudo apt full-upgrade

      Although this may seem like an odd thing, sometimes it's required to remove packages to keep things synchronized between distribution upgrades.

      UPDATING A NEW INSTALLATION

      Obviously, running apt 's upgrade option is something you should do on a regular basis to keep your system up‐to‐date. However, it is especially important to run it after a fresh distribution installation. Usually there are lots of security patches and updates that are released since the last full release of a distribution.

      Uninstalling Software with apt

      Getting rid of software packages with apt is as easy as installing and upgrading them. The only real choice you have to make is whether to keep the software's data and configuration files around afterward.

      To remove a software package but not the data and configuration files, use apt 's remove command. To remove a software package and the related data and configuration files, use the purge option.

      Notice, though, as part of the purge output, apt warns us that the zsh‐common package that was installed

Скачать книгу