首页 > 系统相关 >Programming Linux User Guide

Programming Linux User Guide

时间:2023-01-24 00:56:05浏览次数:58  
标签:software python Programming alternatives update User sdk Guide usr

Programming Linux User Guide

manage software

/opt vs /usr/local

/opt is reserved for the installation of add-on application software packages.

The /usr/local hierarchy is for use by the system administrator when installing software locally. It needs to be safe from being overwritten when the system software is updated. It may be used for programs and data that are shareable among a group
of hosts, but not found in /usr

The biggest difference the two is that software under /usr/localwill be separated into multiple folders, /usr/local/bin, /usr/local/share, /usr/local/lib. And the software under /opt is not the case.

Using the former can be run directly, but I think it loses the flexibility of environment porting.

update-alternatives

With update-alternatives we can run different programs under a generic name.

The command uses symbolic links to keep track of alternatives. Then, update-alternatives accepts commands to manage alternatives without going through the underlying links.

Specifically,when python2 and python3 exist at the same time, we can jointly create a python(alternatives) for them, which is a symbolic link pointing to the specified version. Through update-alternatives, you can avoid operating the link, and quickly add more versions to python, switch versions, and delete a certain version.

update-alternatives works in two ways. The first auto mode when we add pythonX to python, we can set the priority. The second manual mode, specify a version by command.

# Imagine dealing with multiple versions of python(python2, python3)

# Installing New Alternatives(python)
$ sudo update-alternatives --install /usr/local/bin/python python \
/usr/bin/python2 20
$ sudo update-alternatives --install /usr/local/bin/python python \
/usr/bin/python3 40

# Viewing more information
$ update-alternatives --query python
$ update-alternatives --list python

# Changing Alternatives command manually
$ sudo update-alternatives --config python

# Setting Alternatives Mode to Auto
$ sudo update-alternatives --auto python

# Removing Alternative from Alternatives
# sudo update-alternatives --remove python /usr/bin/python2

[ref1](The update-alternatives Command in Linux | Baeldung on Linux) [ref2](How to Use update-alternatives Command on Ubuntu)

sdkman

Better software version management and software environment management than update-alternatives.

update-alternatives can only be used for version control, and sdkman can automatically set the JAVA_HOME environment variable.

Its principle is very simple, it will save all managed software under ~/.sdkman/candidates, and change the PATH variable very roughly to achieve the purpose

#$ sdk current
Using:
java: 14.0.2-zulu
gradle: 6.2.2
 Imagine dealing with multiple version of java

# Installing sdkman
$ curl -s "https://get.sdkman.io" | bash
$ source "$HOME/.sdkman/bin/sdkman-init.sh"

# List All SDK Candidates
# The list command shows all the available candidates, 
# identified by a unique name, the description, the official website, 
# and the installation command
$ sdk list
$ sdk list java

# Install and Manage Java Version
$ sdk install java Identifier                          # online
$ sdk install java _custome_identifier _path_to_target # localy

# Switching Between Versions
$ sdk use java Identifier         # temporarily
$ sdk default java 14.0.1.j9-adpt # permanently

# Remove a Version
$ sdk uninstall java 14.0.1.j9-adpt

# Display the Version in Use
$ sdk current java
$ sdk current

[ref1](Guide to SDKMAN! | Baeldung)

标签:software,python,Programming,alternatives,update,User,sdk,Guide,usr
From: https://www.cnblogs.com/ivanohohoh/p/17065724.html

相关文章

  • Git Guide
    Git&Github为什么学习git&github?git是一个代码版本控制系统,github是git版本库托管平台。学习目的:使用git控制项目版本使用github托管项目借助github使用git......
  • Basic Linux User Guide
    NormalUbuntuUserGuide!ConceptsEverythingisfile.Opensource.Usefulknowledge.desktopfile-shorticonA.desktopfileissimplyashortcutthat......
  • 无法加载文件 C:\Users\Administrator\Desktop\spider01\venv\Scripts\activat
    遇到问题原因Restricted(防止运行没有数字签名的脚本),要设置成remotesigned模式解决方案输入get-executionpolicy以管理员的方式打开Powershall运行,并在命令窗......
  • ENGG1340 Computer Programming II
    课程内容笔记,自用,不涉及任何assignment,exam答案Notesforselfuse,notincludedanyassignmentsorexamsModule0主要介绍了几种远程登录CSdepartment主机的......
  • D - Change Usernames -- ATCODER
    D-ChangeUsernameshttps://atcoder.jp/contests/abc285/tasks/abc285_d 思路DFS深度遍历图。需要注意的是,整个大图中可能有很多小的连通子图,每个子图需要确定起......
  • 无法将“c:\users\XXX\anaconda3\scripts\conda.exe”项识别为 cmdlet、函数、脚
      因为C盘空间不够所以把anaconda3移到D盘了结果PowerShell报错按图索骥找到profile.ps1  把路径修改正确即可! ......
  • [LeetCode] 1817. Finding the Users Active Minutes
    Youaregiventhelogsforusers'actionsonLeetCode,andaninteger k.Thelogsarerepresentedbya2Dintegerarray logs whereeach logs[i]=[IDi,tim......
  • Change Usernames(拓扑序列)
    题目链接题目描述:Yourunawebservicewith\(N\)users.The\(i\)-thuserwithacurrenthandle\(S_i\)wantstochangeitto\(T_i\).Here,\(S_1,…,\)and......
  • 一个User表的增删改查,我写了近200行代码
    Redis多级缓存架构的升级之路​​一、基础版(包含基础操作)​​​​二、升级版1.1(处理缓存数据一致性问题)​​​​三、升级版1.2(处理缓存数据一致性问题)​​​​四、优化版(优......
  • DynamicProgramming动态规划
    ​​WelcomeToMyBlog​​​刚接触动态规划,突然发现这是个很大的领域,所以就先通过别人的分享以及做题逐步总结了.DynamicProgrammingdynamicprogrammingisamethod......