mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-03-21 02:10:11 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
c70d6c4a34
@ -1,8 +1,8 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (hopefully2333)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-11132-1.html)
|
||||
[#]: subject: (How to Manually Install Security Updates on Debian/Ubuntu?)
|
||||
[#]: via: (https://www.2daygeek.com/manually-install-security-updates-ubuntu-debian/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
@ -10,13 +10,11 @@
|
||||
如何在 Debian/Ubuntu 上手动安装安全更新?
|
||||
======
|
||||
|
||||
在 Linux 上通过命令行安装一个包程序是一件简单的事。
|
||||
|
||||
在一行命令中组合使用多个命令能让你更加简单地完成任务。
|
||||
在 Linux 上通过命令行安装一个包程序是一件简单的事。在一行命令中组合使用多个命令能让你更加简单地完成任务。
|
||||
|
||||
安全更新也同样如此。
|
||||
|
||||
在这个教程里面,我们会向你展示如何查看可用的安全更新,以及如何在 Ubuntu,LinuxMint 等等这些基于 Debian 的系统中安装它们。
|
||||
在这个教程里面,我们会向你展示如何查看可用的安全更新,以及如何在 Ubuntu、LinuxMint 等等这些基于 Debian 的系统中安装它们。
|
||||
|
||||
有三种方法可以完成这件事,下面会详细地描述这三种方法。
|
||||
|
||||
@ -24,25 +22,23 @@
|
||||
|
||||
如果你因为一些应用的依赖问题不能解决,导致不能给所有的系统进行全部更新。那至少,你应该打上安全补丁来让你的系统 100% 符合要求。
|
||||
|
||||
### 如何在 Debian/Ubuntu 上安装 unattended-upgrades?
|
||||
|
||||
默认情况下,你的系统上应该是已经安装了 unattended-upgrades 包的。但是如果你的系统没有装这个包,那么请使用下面的命令来安装它。
|
||||
|
||||
使用 **[APT-GET 命令][1]** 或者 **[APT 命令][2]** 来安装 unattended-upgrades 包.
|
||||
|
||||
```
|
||||
$ sudo apt-get install unattended-upgrades
|
||||
or
|
||||
$ sudo apt install unattended-upgrades
|
||||
```
|
||||
|
||||
### 方法一:如何检查 Debian/Ubuntu 中是否有任何可用的安全更新?
|
||||
|
||||
在进行补丁安装之前,检查可用安全更新列表始终是一个好习惯。它会为你提供将在你的系统中进行更新的软件包的列表。
|
||||
|
||||
默认情况下,你的系统上应该是已经安装了 `unattended-upgrades` 包的。但是如果你的系统没有装这个包,那么请使用下面的命令来安装它。
|
||||
|
||||
使用 [APT-GET 命令][1] 或者 [APT 命令][2] 来安装 `unattended-upgrades` 包。
|
||||
|
||||
```
|
||||
$ sudo apt-get install unattended-upgrades
|
||||
或
|
||||
$ sudo apt install unattended-upgrades
|
||||
```
|
||||
|
||||
**什么是试运行?** 大多数的 Linux 命令都有一个试运行选项,它会给出实际的输出但不会下载或安装任何东西。
|
||||
|
||||
为此,你需要在 unattended-upgrades 命令中添加 --dry-run 选项。
|
||||
为此,你需要在 `unattended-upgrades` 命令中添加 `--dry-run` 选项。
|
||||
|
||||
```
|
||||
$ sudo unattended-upgrade --dry-run -d
|
||||
@ -101,9 +97,9 @@ vim-tiny
|
||||
xxd
|
||||
```
|
||||
|
||||
如果在终端里,上面的命令输出说 **“No packages found that can be upgraded unattended and no pending auto-removals”** , 这意味着你的系统已经是最新的了。
|
||||
如果在终端里,上面的命令输出说 “No packages found that can be upgraded unattended and no pending auto-removals”,这意味着你的系统已经是最新的了。
|
||||
|
||||
### 如何在 Debian/Ubuntu 中安装可用的安全更新?
|
||||
#### 如何在 Debian/Ubuntu 中安装可用的安全更新?
|
||||
|
||||
如果你在上面的命令输出中获得了任意的软件包更新,就运行下面的命令来安装它们。
|
||||
|
||||
@ -111,7 +107,7 @@ xxd
|
||||
$ sudo unattended-upgrade -d
|
||||
```
|
||||
|
||||
除此之外,你也可以使用 apt-get 命令来进行安装。但是这个方法有点棘手,我会建议用户用第一个选项。
|
||||
除此之外,你也可以使用 `apt-get` 命令来进行安装。但是这个方法有点棘手,我会建议用户用第一个选项。
|
||||
|
||||
### 方法二:如何使用 apt-get 命令在 Debian/Ubuntu 中检查是否有可用的安全更新?
|
||||
|
||||
@ -160,7 +156,7 @@ Inst gcc [4:7.3.0-3ubuntu2.1] (4:7.4.0-1ubuntu2.3 Ubuntu:18.04/bionic-updates, U
|
||||
Inst g++ [4:7.3.0-3ubuntu2.1] (4:7.4.0-1ubuntu2.3 Ubuntu:18.04/bionic-updates, Ubuntu:18.04/bionic-security [amd64])
|
||||
```
|
||||
|
||||
### 如何使用 apt-get 命令在 Debian/Ubuntu 系统中安装可用的安全更新?
|
||||
#### 如何使用 apt-get 命令在 Debian/Ubuntu 系统中安装可用的安全更新?
|
||||
|
||||
如果你在上面命令的输出中发现任何的软件包更新。就运行下面的命令来安装它们。
|
||||
|
||||
@ -168,7 +164,7 @@ Inst g++ [4:7.3.0-3ubuntu2.1] (4:7.4.0-1ubuntu2.3 Ubuntu:18.04/bionic-updates, U
|
||||
$ sudo apt-get -s dist-upgrade | grep "^Inst" | grep -i securi | awk -F " " {'print $2'} | xargs apt-get install
|
||||
```
|
||||
|
||||
除此之外,也可以使用 apt 命令来完成。但是这个方法有点棘手,我会建议用户用第一个选项。
|
||||
除此之外,也可以使用 `apt` 命令来完成。但是这个方法有点棘手,我会建议用户用第一个方式。
|
||||
|
||||
### 方法三:如何使用 apt 命令在 Debian/Ubuntu 系统中检查是否有可用的安全更新?
|
||||
|
||||
@ -217,7 +213,7 @@ vim-tiny/bionic-updates,bionic-security 2:8.0.1453-1ubuntu1.1 amd64 [upgradable
|
||||
xxd/bionic-updates,bionic-security 2:8.0.1453-1ubuntu1.1 amd64 [upgradable from: 2:8.0.1453-1ubuntu1]
|
||||
```
|
||||
|
||||
### 如何在 Debian/Ubuntu 系统中使用 apt 命令来安装可用的安全更新?
|
||||
#### 如何在 Debian/Ubuntu 系统中使用 apt 命令来安装可用的安全更新?
|
||||
|
||||
如果你在上面命令的输出中发现任何的软件包更新。就运行下面的命令来安装它们。
|
||||
|
||||
@ -241,7 +237,7 @@ via: https://www.2daygeek.com/manually-install-security-updates-ubuntu-debian/
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[hopefully2333](https://github.com/hopefully2333)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,28 +1,28 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (HankChow)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-11133-1.html)
|
||||
[#]: subject: (Save and load Python data with JSON)
|
||||
[#]: via: (https://opensource.com/article/19/7/save-and-load-data-python-json)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
|
||||
使用 Python 处理 JSON 格式数据
|
||||
使用 Python 处理 JSON 格式的数据
|
||||
======
|
||||
如果你不希望从头开始创造一种数据格式来存放数据,JSON 是一个很好的选择。如果你对 Python 有所了解,就更加事半功倍了。下面就来介绍一下如何使用 Python 处理 JSON 数据。
|
||||
|
||||
> 如果你不希望从头开始创造一种数据格式来存放数据,JSON 是一个很好的选择。如果你对 Python 有所了解,就更加事半功倍了。下面就来介绍一下如何使用 Python 处理 JSON 数据。
|
||||
|
||||
![Cloud and databsae incons][1]
|
||||
|
||||
[JSON][2] 的全称是 JavaScript <ruby>对象表示法<rt>Object Notation</rt></ruby>。这是一种以键值对的形式存储数据的格式,并且很容易解析,因而成为了一种被广泛使用的数据格式。另外,不要因为 JSON 名称而望文生义,JSON 并不仅仅在 JavaScript 中使用,它也可以在其它语言中使用。下文会介绍它是如何在 Python 中使用的。
|
||||
[JSON][2] 的全称是 <ruby>JavaScript 对象表示法<rt>JavaScript Object Notation</rt></ruby>。这是一种以键值对的形式存储数据的格式,并且很容易解析,因而成为了一种被广泛使用的数据格式。另外,不要因为 JSON 名称而望文生义,JSON 并不仅仅在 JavaScript 中使用,它也可以在其它语言中使用。下文会介绍它是如何在 Python 中使用的。
|
||||
|
||||
首先我们给出一个 JSON 示例:
|
||||
|
||||
|
||||
```
|
||||
{
|
||||
"name":"tux",
|
||||
"health":"23",
|
||||
"level":"4"
|
||||
"name":"tux",
|
||||
"health":"23",
|
||||
"level":"4"
|
||||
}
|
||||
```
|
||||
|
||||
@ -30,11 +30,10 @@
|
||||
|
||||
### 使用字典存放数据
|
||||
|
||||
如果你的应用需要存储一些结构复杂的数据,不妨考虑使用 JSON 格式。对比你可能曾经用过的自定义格式的文本配置文件,JSON 提供了更加结构化的可递归的存储格式。同时,Python 自带的 `json` 模块已经提供了可以将 JSON 数据导入/导出应用时所需的所有解析库。因此,你不需要针对 JSON 自行编写代码用于解析,而其他开发人员在与你的应用进行数据交互的时候也不需要去解析新的数据格式。正是这个原因,JSON 在数据交换时被广泛地采用了。
|
||||
如果你的应用需要存储一些结构复杂的数据,不妨考虑使用 JSON 格式。对比你可能曾经用过的自定义格式的文本配置文件,JSON 提供了更加结构化的可递归的存储格式。同时,Python 自带的 `json` 模块已经提供了可以将 JSON 数据导入/导出应用时所需的所有解析库。因此,你不需要针对 JSON 自行编写代码进行解析,而其他开发人员在与你的应用进行数据交互的时候也不需要去解析新的数据格式。正是这个原因,JSON 在数据交换时被广泛地采用了。
|
||||
|
||||
以下是一段在 Python 中使用嵌套字典的代码:
|
||||
|
||||
|
||||
```
|
||||
#!/usr/bin/env python3
|
||||
|
||||
@ -57,8 +56,7 @@ team['konqi'] = {'health': 18, 'level': 7}
|
||||
|
||||
### 使用 JSON 格式存储数据
|
||||
|
||||
如果存放在字典中的数据需要被持久性存储,这些数据就需要写到文件当中。这个时候就需要用到 Python 中的 `json` 模块了:
|
||||
|
||||
如果存放在字典中的数据需要持久存储,这些数据就需要写到文件当中。这个时候就需要用到 Python 中的 `json` 模块了:
|
||||
|
||||
```
|
||||
with open('mydata.json', 'w') as f:
|
||||
@ -69,7 +67,6 @@ with open('mydata.json', 'w') as f:
|
||||
|
||||
从应用中导出数据就是这么简单,同时这些导出的数据是结构化的、可理解的。现在可以查看导出的数据:
|
||||
|
||||
|
||||
```
|
||||
$ cat mydata.json
|
||||
{"tux": {"health": 23, "level": 4}, "beastie": {"health": 13, "level": 6}, "konqi": {"health": 18, "level": 7}}
|
||||
@ -79,7 +76,6 @@ $ cat mydata.json
|
||||
|
||||
如果已经将数据以 JSON 格式导出到文件中了,也有可能需要将这些数据读回到应用中去。这个时候,可以使用 Python `json` 模块中的 `load()` 方法:
|
||||
|
||||
|
||||
```
|
||||
#!/usr/bin/env python3
|
||||
|
||||
@ -102,10 +98,9 @@ f.close()
|
||||
|
||||
这个方法实现了和保存文件大致相反的操作。使用一个变量 `f` 来表示打开了的文件,然后使用 `json` 模块中的 `load()` 方法读取文件中的数据并存放到 `team` 变量中。
|
||||
|
||||
其中的 `print()` 展示了如何查看读取到的数据。在过于复杂的字典中迭代调用字典键的时候有可能会稍微转不过弯来,但只要熟悉整个数据的结构,就可以慢慢摸索出其中的逻辑。makes sense.
|
||||
|
||||
当然,这里使用 `print()` 的方式太不灵活了。你可以将其改写成使用 for 循环的形式:
|
||||
其中的 `print()` 展示了如何查看读取到的数据。在过于复杂的字典中迭代调用字典键的时候有可能会稍微转不过弯来,但只要熟悉整个数据的结构,就可以慢慢摸索出其中的逻辑。
|
||||
|
||||
当然,这里使用 `print()` 的方式太不灵活了。你可以将其改写成使用 `for` 循环的形式:
|
||||
|
||||
```
|
||||
for i in team.values():
|
||||
@ -116,7 +111,6 @@ for i in team.values():
|
||||
|
||||
如上所述,在 Python 中可以很轻松地处理 JSON 数据。因此只要你的数据符合 JSON 的模式,就可以选择使用 JSON。JSON 非常灵活易用,下次使用 Python 的时候不妨尝试一下。
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/7/save-and-load-data-python-json
|
||||
@ -124,7 +118,7 @@ via: https://opensource.com/article/19/7/save-and-load-data-python-json
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[HankChow](https://github.com/HankChow)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,162 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Type Linux Commands In Capital Letters To Run Them As Sudo User)
|
||||
[#]: via: (https://www.ostechnix.com/type-linux-commands-in-capital-letters-to-run-them-as-sudo-user/)
|
||||
[#]: author: (sk https://www.ostechnix.com/author/sk/)
|
||||
|
||||
Type Linux Commands In Capital Letters To Run Them As Sudo User
|
||||
======
|
||||
|
||||
![Type Linux Commands In Capital Letters To Run Them As Sudo User][1]
|
||||
|
||||
The reason I love Linux community a lot is they create so many FUN projects which you rarely find in any other propriety operating systems. A while ago, we looked at a fun project named [**“Hollywood”**][2] which turns the Terminal into a Hollywood technical melodrama hacker interface in Ubuntu-like systems. There are few other utilities available, for example **cowsay** , **fortune** , **sl** and **toilet** (!) etc., to kill your free time and keep you entertained! They may not be useful, but these utilities are really entertaining and fun to use. Today, I stumbled upon yet another similar utility named **“SUDO”**. As the name implies, whenever you type Linux commands in capital letters, the SUDO utility will run them as sudo user! Meaning, you need not to type “sudo” in-front of the Linux commands you about to run. Cool, yeah?
|
||||
|
||||
### Install SUDO
|
||||
|
||||
* * *
|
||||
|
||||
**A word of caution:**
|
||||
|
||||
Before installing this (or any utility), take a look at the source code (Link given at the end) and see if there are suspicious/malicious code included to harm your system. Test it in a VM. If you like or found it useful, you can use it in your personal/production systems.
|
||||
|
||||
* * *
|
||||
|
||||
Git clone the SUDO repository:
|
||||
|
||||
```
|
||||
$ git clone https://github.com/jthistle/SUDO.git
|
||||
```
|
||||
|
||||
This command will clone the contents of SUDO GIT repository and saves them in a directory named “SUDO” in your current working directory.
|
||||
|
||||
```
|
||||
Cloning into 'SUDO'...
|
||||
remote: Enumerating objects: 42, done.
|
||||
remote: Counting objects: 100% (42/42), done.
|
||||
remote: Compressing objects: 100% (29/29), done.
|
||||
remote: Total 42 (delta 17), reused 30 (delta 12), pack-reused 0
|
||||
Unpacking objects: 100% (42/42), done.
|
||||
```
|
||||
|
||||
Switch to SUDO directory:
|
||||
|
||||
```
|
||||
$ cd SUDO/
|
||||
```
|
||||
|
||||
And, install it using command:
|
||||
|
||||
```
|
||||
$ ./install.sh
|
||||
```
|
||||
|
||||
The command will add the following entries in your **~/.bashrc** file:
|
||||
|
||||
```
|
||||
[...]
|
||||
# SUDO - shout at bash to su commands
|
||||
# Distributed under GNU GPLv2, @jthistle on github
|
||||
|
||||
shopt -s expand_aliases
|
||||
|
||||
IFS_=${IFS}
|
||||
IFS=":" read -ra PATHS <<< "$PATH"
|
||||
|
||||
for i in "${PATHS[@]}"; do
|
||||
for j in $( ls "$i" ); do
|
||||
if [ ${j^^} != $j ] && [ $j != "sudo" ]; then
|
||||
alias ${j^^}="sudo $j"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
alias SUDO='sudo $(history -p !!)'
|
||||
|
||||
IFS=${IFS_}
|
||||
|
||||
# end SUDO
|
||||
```
|
||||
|
||||
It will also take a backup of your **~/.bashrc** and save it as **~/.bashrc.old**. You can restore it if anything goes catastrophically wrong.
|
||||
|
||||
Finally, update the changes using command:
|
||||
|
||||
```
|
||||
$ source ~/.bashrc
|
||||
```
|
||||
|
||||
### Now, type Linux Commands in Capital letters to run them as Sudo user
|
||||
|
||||
Usually, we execute Linux commands that requires sudo/root privileges like below.
|
||||
|
||||
```
|
||||
$ sudo mkdir /ostechnix
|
||||
```
|
||||
|
||||
Right? Yes! The above command will create directory named “ostechnix” in root (/). Let us cancel this command using **Ctrl+c**.
|
||||
|
||||
Once SUDO is installed, you can **type any Linux command in capital without sudo** and run them. So, you can run the above command like below:
|
||||
|
||||
```
|
||||
$ MKDIR /ostechnix
|
||||
|
||||
$ TOUCH /ostechnix/test.txt
|
||||
|
||||
$ LS /ostechnix
|
||||
```
|
||||
|
||||
![][3]
|
||||
|
||||
Type Linux Commands In Capital Letters To Run Them As Sudo User
|
||||
|
||||
Please note that **it will not bypass the sudo password**. You still need to type sudo password to execute the given command. It will only help to avoid typing “sudo” in-front of each command.
|
||||
|
||||
* * *
|
||||
|
||||
**Related read:**
|
||||
|
||||
* [**How To Run Particular Commands Without Sudo Password In Linux**][4]
|
||||
* [**How To Restore Sudo Privileges To A User**][5]
|
||||
* [**How To Grant And Remove Sudo Privileges To Users On Ubuntu**][6]
|
||||
* [**How To Find All Sudo Users In Your Linux System**][7]
|
||||
* [**How To Display Asterisks When You Type Password In Terminal**][8]
|
||||
* [**How To Change The Sudo Prompt In Linux**][9]
|
||||
|
||||
|
||||
|
||||
* * *
|
||||
|
||||
Of course, typing “sudo” will take only a few seconds, so it is not a big deal. I must tell this is just fun and USELESS project to pass time. If you don’t like it, go away and learn something useful. If you like it, give it a go and have fun!
|
||||
|
||||
**Resource:**
|
||||
|
||||
* [**SUDO GitHub Repository**][10]
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/type-linux-commands-in-capital-letters-to-run-them-as-sudo-user/
|
||||
|
||||
作者:[sk][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.ostechnix.com/author/sk/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.ostechnix.com/wp-content/uploads/2019/07/sudo-720x340.png
|
||||
[2]: https://www.ostechnix.com/turn-ubuntu-terminal-hollywood-technical-melodrama-hacker-interface/
|
||||
[3]: https://www.ostechnix.com/wp-content/uploads/2019/07/SUDO-in-action.gif
|
||||
[4]: https://www.ostechnix.com/run-particular-commands-without-sudo-password-linux/
|
||||
[5]: https://www.ostechnix.com/how-to-restore-sudo-privileges-to-a-user/
|
||||
[6]: https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users-on-ubuntu/
|
||||
[7]: https://www.ostechnix.com/find-sudo-users-linux-system/
|
||||
[8]: https://www.ostechnix.com/display-asterisks-type-password-terminal/
|
||||
[9]: https://www.ostechnix.com/change-sudo-prompt-linux-unix/
|
||||
[10]: https://github.com/jthistle/SUDO
|
@ -0,0 +1,165 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to Upgrade Debian 9 (Stretch) to Debian 10 (Buster) via Command Line)
|
||||
[#]: via: (https://www.linuxtechi.com/upgrade-debian-9-to-debian-10-command-line/)
|
||||
[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/)
|
||||
|
||||
How to Upgrade Debian 9 (Stretch) to Debian 10 (Buster) via Command Line
|
||||
======
|
||||
|
||||
Hello All!!!, Good to See you! So we saw how to install [Debian 10(Buster)][1] in the previous article. Today, we are going to learn how to upgrade from Debian 9 to Debian 10. Since we have already seen about Debian 10 and its features, let’s not go deep into it. But readers who didn’t have the chance to read that article, let’s give a quick update about Debian 10 and its new features.
|
||||
|
||||
<https://www.linuxtechi.com/wp-content/uploads/2019/07/Upgrade-Debian-9-to-Debian-10.jpg>
|
||||
|
||||
After almost two years of development, the team at Debian has finally released a stable version of Buster, code name for Debian 10. Buster is a LTS (Long Term Support) version and hence will be supported for the next 5 years by Debian.
|
||||
|
||||
### Debian 10 (Buster) – New Features
|
||||
|
||||
Debian 10 (Buster) comes packed with a lot of new features which could be rewarding to most of the Debian fans out there. Some of the features include:
|
||||
|
||||
* GNOME Desktop 3.30
|
||||
* AppArmor enabled by default
|
||||
* Supports Linux Kernel 4.19.0-4
|
||||
* Supports OpenJDk 11.0
|
||||
* Moved from Nodejs 4-8 to Nodejs 10.15.2
|
||||
* Iptables replaced by NFTables
|
||||
|
||||
|
||||
|
||||
and a lot more.
|
||||
|
||||
### Step by Step Guide to Upgrade from Debian 9 to Debian 10
|
||||
|
||||
Before we start upgrading to Debian 10, let’s look at the prerequisites needed for the upgrade:
|
||||
|
||||
### Step 1) Debian upgrade prerequisites
|
||||
|
||||
* A good internet connection
|
||||
* Root user permission
|
||||
* Data backup
|
||||
|
||||
|
||||
|
||||
It is extremely important to backup all your application code bases, data files, user account details, configuration files, so that you can always revert to the previous version if anything goes wrong during the upgrade.
|
||||
|
||||
### Step 2) Upgrade Debian 9 Existing Packages
|
||||
|
||||
Next step is to upgrade all your existing packages as any packages that are tagged as held back cannot be upgraded and there is a possibility the upgrade from Debian 9 to Debian 10 may fail or cause some issues. So, let’s not take any chances and better upgrade the packages. Use the following code to upgrade the packages:
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo apt update && sudo apt upgrade -y
|
||||
```
|
||||
|
||||
### Step 3) Modify Package Repository file (/etc/sources.list)
|
||||
|
||||
Next step is to modify package repository file “/etc/sources.list” where you need to replace the text “Stretch” with the text “Buster”.
|
||||
|
||||
But before you change anything, make sure to create a backup of the sources.list file as shown below:
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
|
||||
```
|
||||
|
||||
Now use below sed commands to replace the text ‘**stretch**‘ with ‘**buster**‘ in package repository file, example is shown below,
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo sed -i 's/stretch/buster/g' /etc/apt/sources.list
|
||||
root@linuxtechi:~$ sudo sed -i 's/stretch/buster/g' /etc/apt/sources.list.d/*.list
|
||||
```
|
||||
|
||||
Once the text is updated, you need to update the package index like shown below:
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo apt update
|
||||
```
|
||||
|
||||
Before start upgrading your existing Debian OS , let’s verify the current version using the following command,
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ cat /etc/*-release
|
||||
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
|
||||
NAME="Debian GNU/Linux"
|
||||
VERSION_ID="9"
|
||||
VERSION="9 (stretch)"
|
||||
ID=debian
|
||||
HOME_URL="https://www.debian.org/"
|
||||
SUPPORT_URL="https://www.debian.org/support"
|
||||
BUG_REPORT_URL="https://bugs.debian.org/"
|
||||
root@linuxtechi:~$
|
||||
```
|
||||
|
||||
### Step 4) Upgrade from Debian 9 to Debian 10
|
||||
|
||||
Once you made all the changes, it is time to upgrade from Debian 9 – Debian 10. But before that, make sure to update your packages again as shown below:
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo apt update && sudo apt upgrade -y
|
||||
```
|
||||
|
||||
During packages upgrade you will be prompted to start the services, so choose your preferred option
|
||||
|
||||
Once all the packages are updated in your system, it is time to upgrade your distribution package. Use the following code to upgrade the distribution:
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo apt dist-upgrade -y
|
||||
```
|
||||
|
||||
The upgrade process may take a few minutes depending upon your internet connection. Remember during the upgrade process, you’ll also be asked a few questions whether you need to restart the services during the packages are upgraded and whether you need to keep the existing configurations files. If you don’t want to make any custom changes, simply type “Y” and let the upgrade process continue.
|
||||
|
||||
### Step 5) Verify Upgrade
|
||||
|
||||
Once the upgrade process is completed, reboot your machine and check the version using the following command:
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ lsb_release -a
|
||||
```
|
||||
|
||||
If you get the output as shown below:
|
||||
|
||||
```
|
||||
Distributor ID: Debian
|
||||
Description: Debian GNU/Linux 10 (buster)
|
||||
Release: 10
|
||||
Codename: buster
|
||||
root@linuxtechi:~$
|
||||
```
|
||||
|
||||
Yes, you have successfully upgraded from Debian 9 to Debian 10.
|
||||
|
||||
Alternate way to verify upgrade
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ cat /etc/*-release
|
||||
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
|
||||
NAME="Debian GNU/Linux"
|
||||
VERSION_ID="10"
|
||||
VERSION="10 (buster)"
|
||||
VERSION_CODENAME=buster
|
||||
ID=debian
|
||||
HOME_URL="https://www.debian.org/"
|
||||
SUPPORT_URL="https://www.debian.org/support"
|
||||
BUG_REPORT_URL="https://bugs.debian.org/"
|
||||
root@linuxtechi:~$
|
||||
```
|
||||
|
||||
### Conclusion
|
||||
|
||||
Hope the above step by step guide provided you with all the information needed to upgrade from Debian 9(Stretch) to Debian 10 (Buster) easily. Please give us your feedback, suggestions and your experiences with the all new Debian 10 in the comments section. For more such Linux tutorials and articles, keep visiting LinuxTechi.com every now and then.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linuxtechi.com/upgrade-debian-9-to-debian-10-command-line/
|
||||
|
||||
作者:[Pradeep Kumar][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.linuxtechi.com/author/pradeep/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.linuxtechi.com/debian-10-buster-installation-guide/
|
@ -0,0 +1,163 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Type Linux Commands In Capital Letters To Run Them As Sudo User)
|
||||
[#]: via: (https://www.ostechnix.com/type-linux-commands-in-capital-letters-to-run-them-as-sudo-user/)
|
||||
[#]: author: (sk https://www.ostechnix.com/author/sk/)
|
||||
|
||||
用大写字母输入 Linux 命令以将其作为 Sudo 用户运行
|
||||
======
|
||||
|
||||
![Type Linux Commands In Capital Letters To Run Them As Sudo User][1]
|
||||
|
||||
我非常喜欢 Linux 社区的原因是他们创建了很多有趣的项目,你很少能在任何其他操作系统中找到它们。不久前,我们看了一个名为 [**“Hollywood”**][2] 的有趣项目,它在类 Ubuntu 系统将终端变成了好莱坞技术情景剧的黑客界面。还有一些其他工具,例如 **cowsay**、**fortune**、**sl** 和 **toilet** 等,用来打开时间和自娱自乐!它们可能没有用,但这些程序娱乐性不错并且使用起来很有趣。今天,我偶然发现了另一个名为 **“SUDO”** 的类似工具。正如名字暗示的那样,你无论何时用大写字母输入 Linux 命令,SUDO 程序都会将它们作为 sudo 用户运行!这意味着,你无需在要运行的 Linux 命令前面输入 “sudo”。很酷,不是么?
|
||||
|
||||
|
||||
### 安装 SUDO
|
||||
|
||||
* * *
|
||||
|
||||
**提醒一句:**
|
||||
|
||||
在安装(或任何程序)之前,请查看源代码(最后给出的链接),并查看是否包含会损害你的系统的可疑/恶意代码。在 VM中 测试它。如果你喜欢或觉得它很有用,你可以在个人/生产系统中使用它。
|
||||
|
||||
* * *
|
||||
|
||||
用 Git 克隆 SUDO 仓库:
|
||||
|
||||
```
|
||||
$ git clone https://github.com/jthistle/SUDO.git
|
||||
```
|
||||
|
||||
此命令将克隆 SUDO GIT 仓库的内容,并将它们保存在当前目录下的 “SUDO” 的目录中。
|
||||
|
||||
```
|
||||
Cloning into 'SUDO'...
|
||||
remote: Enumerating objects: 42, done.
|
||||
remote: Counting objects: 100% (42/42), done.
|
||||
remote: Compressing objects: 100% (29/29), done.
|
||||
remote: Total 42 (delta 17), reused 30 (delta 12), pack-reused 0
|
||||
Unpacking objects: 100% (42/42), done.
|
||||
```
|
||||
|
||||
切换到 SUDO 目录:
|
||||
|
||||
```
|
||||
$ cd SUDO/
|
||||
```
|
||||
|
||||
并使用命令安装它:
|
||||
|
||||
```
|
||||
$ ./install.sh
|
||||
```
|
||||
|
||||
该命令将在 **~/.bashrc** 文件中添加以下行:
|
||||
|
||||
```
|
||||
[...]
|
||||
# SUDO - shout at bash to su commands
|
||||
# Distributed under GNU GPLv2, @jthistle on github
|
||||
|
||||
shopt -s expand_aliases
|
||||
|
||||
IFS_=${IFS}
|
||||
IFS=":" read -ra PATHS <<< "$PATH"
|
||||
|
||||
for i in "${PATHS[@]}"; do
|
||||
for j in $( ls "$i" ); do
|
||||
if [ ${j^^} != $j ] && [ $j != "sudo" ]; then
|
||||
alias ${j^^}="sudo $j"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
alias SUDO='sudo $(history -p !!)'
|
||||
|
||||
IFS=${IFS_}
|
||||
|
||||
# end SUDO
|
||||
```
|
||||
|
||||
它还会备份你的 **~/.bashrc** 并将其保存为 **~/.bashrc.old**。如果有重大错误,你可以恢复它。
|
||||
|
||||
最后,使用命令更新更改:
|
||||
|
||||
```
|
||||
$ source ~/.bashrc
|
||||
```
|
||||
|
||||
### 现在,用大写字母中输入 Linux 命令,将它们作为 Sudo 用户运行
|
||||
|
||||
通常我们像下面那样执行需要 sudo/root 权限的命令。
|
||||
|
||||
```
|
||||
$ sudo mkdir /ostechnix
|
||||
```
|
||||
|
||||
对么?没错!上面的命令将在根目录(/)中创建名为 “ostechnix” 的目录。让我们使用 **Ctrl + c** 取消。
|
||||
|
||||
一旦安装了 SUDO,你就可以**在没有 sudo 的情况下输入任何大写 Linux 命令**并运行它们。因此,你可以像下面那样运行上面的命令:
|
||||
|
||||
```
|
||||
$ MKDIR /ostechnix
|
||||
|
||||
$ TOUCH /ostechnix/test.txt
|
||||
|
||||
$ LS /ostechnix
|
||||
```
|
||||
|
||||
![][3]
|
||||
|
||||
用大写字母输入 Linux 命令以将其作为 Sudo 用户运行
|
||||
|
||||
请注意**它无法绕过 sudo 密码**。你仍然需要键入 sudo 密码才能执行给定的命令。它只会有助于避免在每个命令前面输入“sudo”。
|
||||
|
||||
* * *
|
||||
|
||||
**相关阅读:Related read:=**
|
||||
|
||||
* [**如何在 Linux 中没有 Sudo 密码运行特定命令**][4]
|
||||
* [**如何恢复用户的 Sudo 权限**][5]
|
||||
* [**如何在 Ubuntu 上为用户授予和删除 Sudo 权限**][6]
|
||||
* [**如何在 Linux 系统中查找所有 Sudo 用户**][7]
|
||||
* [**如何在终端中输入密码时显示星号**][8]
|
||||
* [**如何更改 Linux 中的 Sudo 提示符**][9]
|
||||
|
||||
|
||||
|
||||
* * *
|
||||
|
||||
当然,输入 “sudo” 只需几秒钟,所以这不是什么大问题。 我必须告诉这是一个用来消磨时间的有趣且无用的项目。 如果你不喜欢它,那就去学习一些有用的东西吧。 如果你喜欢它,试一试,玩得开心!
|
||||
|
||||
**资源:**
|
||||
|
||||
* [**SUDO GitHub 仓库**][10]
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/type-linux-commands-in-capital-letters-to-run-them-as-sudo-user/
|
||||
|
||||
作者:[sk][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.ostechnix.com/author/sk/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.ostechnix.com/wp-content/uploads/2019/07/sudo-720x340.png
|
||||
[2]: https://www.ostechnix.com/turn-ubuntu-terminal-hollywood-technical-melodrama-hacker-interface/
|
||||
[3]: https://www.ostechnix.com/wp-content/uploads/2019/07/SUDO-in-action.gif
|
||||
[4]: https://www.ostechnix.com/run-particular-commands-without-sudo-password-linux/
|
||||
[5]: https://www.ostechnix.com/how-to-restore-sudo-privileges-to-a-user/
|
||||
[6]: https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users-on-ubuntu/
|
||||
[7]: https://www.ostechnix.com/find-sudo-users-linux-system/
|
||||
[8]: https://www.ostechnix.com/display-asterisks-type-password-terminal/
|
||||
[9]: https://www.ostechnix.com/change-sudo-prompt-linux-unix/
|
||||
[10]: https://github.com/jthistle/SUDO
|
Loading…
Reference in New Issue
Block a user