Linux post install script

Ubuntu Post Installation Script To Install Essential Applications

Even though Ubuntu is a newbie user-friendly Linux operating system, it doesn’t comes with all necessary pre-installed stuffs for day to day usage. You may still have to install some additional software in order to get a near perfect system. You can manually install those extra packages one by one, but It’s bit time consuming task. Alternatively, use the following script called post_install.sh written by a fellow Linux user Waleed ahmad. He made this script to make the Ubuntu post installation tasks much easier and faster. Just grab this script and run it with root or sudo privileges and install the necessary applications. This is script is available in GitHub. It is completely free to use.

Applications in Ubuntu Post installation Script

This script will install the following applications.

  1. Sublime Text 3,
  2. LAMP Stack,
  3. Build Essentials,
  4. Node.js,
  5. Git,
  6. Composer,
  7. JDK 8,
  8. Bleachbit,
  9. Ubuntu Restricted Extras,
  10. VLC Media Player,
  11. Unity Tweak Tool,
  12. Google Chrome,
  13. Teamiewer,
  14. Skype,
  15. Paper GTK Theme,
  16. Arch Theme,
  17. Arc Icons,
  18. Numix Icons,
  19. Multiload Indicator,
  20. Pensor,
  21. Netspeed Indicator,
  22. Generate SSH Keys,
  23. Ruby,
  24. Sass,
  25. Vnstat,
  26. Webpack,
  27. Grunt,
  28. Gulp.

Run Ubuntu Post Installation Script

Download the script from here or use the following command to download it using wget command:

$ wget -d -c -O post_install.sh https://gist.githubusercontent.com/waleedahmad/a5b17e73c7daebdd048f823c68d1f57a/raw/4c334a4b52b848df9501ad394ad07ddb1648fe2a/post_install.sh

I have saved this file as post_install.sh . You can name it as per your liking. Then, make it as executable using command:

Finally, run this script as ‘ sudo ‘ user:

This script will automatically update your software repositories lists, upgrade your Ubuntu desktop. And then it will enable any PPAs if necessary.

Run Ubuntu Post Installation Script

Once it updated your system, then it will display the list of essential applications you would like to have in your Ubuntu desktop. Just choose any application(s) you want to install and hit ENTER key. This script will download and install the selected applications along with all required dependencies.

Install Essential Applications In Ubuntu

Very simple, isn’t it? What are you waiting for go get this script and start installing the packages you want.

Hope this script helps you. More details, refer the official GitHub page.

sk

Senthilkumar Palani (aka SK) is the Founder and Editor in chief of OSTechNix. He is a Linux/Unix enthusiast and FOSS supporter. He lives in Tamilnadu, India.

Читайте также:  Sys socket h linux

Источник

What is a post-installation script for a package?

What is a post-installation script, exactly? Where are post-installation scripts located? I came across this question that is somewhat related, but it discusses post-installation triggers rather than post-installation scripts.

«Advanced package manager detects the post-installation script and Dpkg runs the script.» Nope. Dpkg is the sole handler of postinst scripts. Apt has nothing to do with it. Apt calls dpkg to do most things, remember.

1 Answer 1

The name of the script itself says what it does. In other words, the script contains commands that should be executed after installation is complete.

Let’s understand it in a better way through an example:

  • Assume you’re installing a newer kernel. Once the installation of the .deb file is complete, it needs to tell GRUB that the kernel is installed, so that you can boot into it. So the post-installation of the package will tell GRUB that the kernel is installed by executing the commands update-grub and update-initramfs . For more info see the FAQ section.

A more generic example can be this:

  • Assume you’re installing the package foo . Let’s say now that the package needs a service called bar to be disabled. How will it disable it? The developers will add the command systemctl disable bar.service , which will disable the service, in the foo package’s post-installation script. So the package’s post-installation script consists of additional commands, updates etc. Installation consists of the following steps:
    1. Extract the control files of the new package.
    2. If another version of the same package was installed before the new installation, execute prerm script of the old package.
    3. Run preinst script, if provided by the package.
    4. Unpack the new files, and at the same time back up the old files, so that if something goes wrong, they can be restored.
    5. If another version of the same package was installed before the new installation, execute the postrm script of the old package. Note that this script is executed after the preinst script of the new package, because new files are written at the same time old files are removed.
    6. Configure the package.

Post-installation comes under the «Configure the package». It consists of:

  1. Telling other applications about the successful installation of the package.
  2. Precising paths to the package so that users and other applications can use/execute it.
  3. Look for any errors in the installation and print the error message.

FAQ section

    Where are these scripts located? These scripts are located in /var/lib/dpkg/info . These scripts have a .postinst extension. You can run locate .postinst to find more of these scripts. A sample post-installation script looks like this:
#!/bin/sh set -e if [ -x /usr/sbin/update-initramfs ]; then /usr/sbin/update-initramfs -u -k all fi 
Command Description Forceful Syntax
apt purge Removes the package along with its configuration files. Depends on the situation. sudo apt purge
dpkg -r Removes the package forcefully. Offers a lot of useful arguments. Yes, when used with certain arguments sudo dpkg -r —force-all
dpkg -P Purges the package forcefully. Offers a lot of useful arguments. Yes, when used with certain arguments. sudo dpkg -P —force-all
  • Your Ubuntu version (output of lsb_release -d ).
  • Output of sudo apt update .
  • Full output of sudo apt -f install .
  • Contents of the post-installation script of the package.

Other details should be provided when asked.

Friends and relatives of this script.

Try running ls in /var/lib/dpkg/info and grep the output with the pattern aptitude . You’ll find a lot of similar kinds of scripts as it’s output. Some of them are .postrm , .preinst , prerm and .list along with the signatures file. Here is a table showing the functions of each of these scripts:

Script Function
Post removal ( .postrm ) This script consists of commands to be run AFTER the removal is complete.
Pre-installation ( .preinst ) This script consists of commands to be run before the installation.
Pre-removal ( .prerm ) this script consists of the commands to be run before the removal process
Lists file ( .list ) This file contains the list of directories owned/belongs to the package.

For more information refer to the manpage of dpkg

Источник

What can it do?¶

If you chose to add WineHQ repository, i386 architecture is automatically enabled AFTER adding WineHQ repository.

Note about Podman repository¶

Podman repository(provided by Kubic project) also provides golang package for some reason. So please be careful while installing golang via apt.

Add personal package archives (PPA)¶

 3   - ppa:yubico/stable  - kicad/kicad-5.1-releases

Install apt packages¶

There are seven list of packages under key config.install.apt.

  1. administration - Contains Administrative packages
  2. security - Contains Security related tools and packages
  3. productivity - Office tools, writing tools, LateX, document tools and other productivity tools, Email clients, browsers, IM clients etc.
  4. multimedia - Multimedia tools like media players, audio converters and players etc.
  5. development - IDEs, languages [go, python, ruby, rust, java etc], Containers [docker lxc rkt etc], Python libraries, compilers [gcc, clang] SDKs [AWS SDK, Google Cloud SDK, open-jdk, Tensor Flow], headers and libraries. Anything related to development and -dev or -devl packages.
  6. other - Everything which does not fit in the above categories. Themes, Tools, Utilities etc.
  7. external - Any packages which are provided by PPAs, or repositories not present in base Ubuntu distribution. There's a possibility that the repository might not be added or may be unavailable or offline. So Keeping the list separate from others packages minimizes errors if there are any.

This classification is only for ease of use and need not be strictly followed. You can put vlc package in security , it will be installed without issues.

Special list of packages - Purge list¶

There is a special package list config.purge containing list of packages to be purged from the system. This only applies if purge flag is set and purge task is enabled (when autopilot is active)

 3  - gnome-mines - gnome-sudoku - aisleriot - gnome-mahjongg

Install Debian package archives (.deb files)¶

This will install deb files specified in the YAML config under config.install.debs .

 3   - https://atom-installer.github.com/v1.21.1/atom-amd64.deb

Install Static binaries to /usr/local/bin¶

This will install binaries in YAML config under config.install.binaries .

  • Simulate option will download the binary but not install it.
  • Configuration is of format binary-name::URL . Binary name MUST mach regex ^([a-zA-z0-9_-]+)$ .
  • For example, to install kubectl , the entry should look like below.
 3   - kubectl::https://storage.googleapis.com/kubernetes-release/release/v1.20.1/bin/linux/amd64/kubectl

Purge Unwanted Packages¶

This will purge Unwanted packages from the system.

It is necessary to pass command line argument -d or set config.flags.purge_enabled: true in config.

Installing Snap packages¶

Script can install snap packages from snap-store. You MUST specify the classic snaps with prefix classic:: See example below. Edge snaps MUST be prefixed with edge::

 3   - htop - classic::vscode - classic::edge::hugo

All In one¶

This will perform Following actions. (In the following order)

  • Update repository metadata
  • Upgrade packages
  • Add repositories
  • Add PPAs
  • Install APT packages
  • Install DEB files
  • Install static binaries
  • Install snap packages

This option will honor --autopilot and --simulate options as individual tasks would do.

AUTOPILOT Mode¶

Using --autopilot will skip all UI prompts and confirmations. This mode requires you to specify tasks to be run if using YAML config. Example snippet is given below.

 3    true  true    true   true   true   true   true   true   true   Name Key    Update APT Metadata(Same as running apt-get update ) update  Upgrade packages upgrade  Add Repositories add_repo  Add personal package archives (PPA) ppa  Install apt packages apt  Install Debian package archives (.deb files) debs  Install Static binaries to /usr/local/bin binaries  Purge Unwanted Packages purge  Installing Snap packages snaps    

Delete logs¶

A log file is generated containing all the output generated by the apt and other commands

Источник

Оцените статью
Adblock
detector