# Ubuntu配置IP及免密登录

* <https://github.com/nodesource/distributions#debinstall>

### Node.js v17.x

```python
# As root
curl -fsSL https://rpm.nodesource.com/setup_17.x | bash -

# No root privileges
curl -fsSL https://rpm.nodesource.com/setup_17.x | sudo bash -
```

### Node.js v16.x

```bash
# As root
curl -fsSL https://rpm.nodesource.com/setup_16.x | bash -

# No root privileges
curl -fsSL https://rpm.nodesource.com/setup_16.x | sudo bash -
```

### ubuntu18.04配置静态ip

**注意：** 18.04和16.04不一样了，配置静态ip的方法有很大差异！

查找`netplan`目录下默认的网络配置文件，文件后缀为`.yaml`，我的是叫`00-installer-config.yaml`的文件。如果没有可以使用`sudo gedit 00-installer-config.yaml`自己创建

```bash
wang@1:/etc/netplan$ sudo cp 00-installer-config.yaml 00-installer-config.yaml.bak
[sudo] password for wang: 

wang@1:/etc/netplan$ ls
00-installer-config.yaml  00-installer-config.yaml.bak

wang@1:/etc/netplan$ sudo vi 00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
  ethernets:
    ens160:
      dhcp4: no
      addresses: [10.11.9.247/24]
      gateway4: 10.11.9.254
      nameservers:
        addresses: [8.8.8.8,8.8.4.4]
  version: 2


wang@1:/etc/netplan$ sudo netplan apply



wang@1:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:11:55:62 brd ff:ff:ff:ff:ff:ff
    inet 10.11.9.247/24 brd 10.11.9.255 scope global ens160
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe11:5562/64 scope link 
       valid_lft forever preferred_lft forever
```

### ubuntu 24 TLS 配置静态IP

```bash
ubuntu@single-k3s:~$ sudo cat /etc/netplan/You.yaml
# This is the network config written by 'subiquity'
network:
  ethernets:
    ens160:
      addresses:
      - 172.30.10.67/23
      nameservers:
        addresses:
        - 8.8.8.8
        - 8.8.4.4
        search: []
      routes:
      - to: default
        via: 172.30.11.254
  version: 2


netplan apply 
ip addr show
```

### ubuntu 免密登录

**创建authorized\_keys**

只要客户端的公钥能够与这个文件中进行匹配就可以实现登录。

```bash
#切换到 用户目录
cd /home/用户/
#创建.ssh文件夹
mkdir .ssh
#切换到.ssh目录
cd .ssh
#创建文件并编辑文件
vi authorized_keys
```

### ERROR: No matching distribution found for mysqlclient==2.0.3

您可能需要像这样安装 Python 3 和 MySQL 开发头文件和库：

sudo apt-get install python3-dev default-libmysqlclient-dev build-essential # Debian / Ubuntu sudo yum install python3-devel mysql-devel # 红帽 / CentOS 然后你现在可以通过pip安装mysqlclient：

$ pip install mysqlclient

### Ubuntu 密码和用户密码修改

**（没有忘记密码的情况下如何修改密码）**

a. 重置(修改)root密码

ubuntu的root初始密码是随机的，每次开机都有一个新的,root密码修改方法如下:

```bash
1. sudo passwd root
2. 此处需要输入用户名密码
3. 两次输入设定的 root 新密码即可。
4. 测试是否生效，输入 su root 切换到 root 管理员
5. 输入第3步设置的如root新密码就行
```

b. 修改用户名密码

Ubuntu更改密码步骤：

```bash
1. 打开一个终端，输入 sudo su 转为root用户。 注意，必须先转为root用户！！！
2. sudo passwd user(user 是对应的用户名)
3. 输入新密码，确认密码。
4. 修改密码成功，重启，输入新密码进入Ubuntu。
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://close.gitbook.io/yun-wei-bi-ji/centos/linux-ji-cao/ubuntu-pei-zhi-ip-ji-mian-mi-deng-lu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
