Skip to content

Commit

Permalink
较小的改动
Browse files Browse the repository at this point in the history
  • Loading branch information
No-Github committed Apr 20, 2022
1 parent 3a0ffd5 commit 9f82fde
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 83 deletions.
6 changes: 3 additions & 3 deletions 1earn/Develop/Web/笔记/认证&授权.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ Registered claims 有特殊含义,比如 iat、exp 等,iat 表示 JWT 生成

```json
{
  "sub": "123456789",
  "name": "shiroshiro",
  "admin": false
"sub": "123456789",
"name": "shiroshiro",
"admin": false
}
```

Expand Down
37 changes: 37 additions & 0 deletions 1earn/Integrated/Linux/Power-Linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -2499,6 +2499,31 @@ less /var/log/nginx/error.log
---
### php-cli
**交互式 shell**
```bash
php -a
php > echo "hello";
hello
php > $x = 3;
php > $y = 2;
php > echo ($x + $y);
```

**运行 PHP 文件**
```bash
php -f test.php
```

**运行 web 服务器**
```bash
php -S 0.0.0.0:8080
```

---

### phpMyAdmin

<p align="center">
Expand Down Expand Up @@ -3529,6 +3554,18 @@ shutdown

整个启动和关闭的过程都会记录在 alert 日志文件中。

**docker 部署**

```bash
# https://github.com/wnameless/docker-oracle-xe-11g
docker pull wnameless/oracle-xe-11g-r2
docker run -d -p 1521:1521 -e ORACLE_ALLOW_REMOTE=true wnameless/oracle-xe-11g-r2

# https://hub.docker.com/r/gvenzl/oracle-xe
docker pull gvenzl/oracle-xe:11
docker run -d -p 1521:1521 -e ORACLE_PASSWORD=123123123 gvenzl/oracle-xe:11
```

---

#### Mariadb
Expand Down
4 changes: 2 additions & 2 deletions 1earn/Integrated/Linux/Secure-Linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -529,10 +529,10 @@ auditctl -w /bin/rm -p x -k removefile

## SELinux

**关闭 SELinux**
**关闭 SELinux**
- 需要重启
```vim
vim /etc/selinux/config
vim /etc/selinux/config

SELINUX=disabled
```
Expand Down
24 changes: 22 additions & 2 deletions 1earn/Integrated/Linux/Speed-Linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,14 @@ hostnamectl set-hostname test # 修改 hostname 立即生效且重启也生效
resolvconf -u
```

- 如果可以 ping 通 ip,但 ping 不通域名, 那么有以下几种原因
- 没有配置好 /etc/resolv.conf
- /etc/nsswitch.conf 文件删除 DNS 解析记录
```bash
grep hosts /etc/nsswitch.conf
# 一般只有 files host 如果没有就添加 host
```

**修改 IP**
- Ubuntu
```bash
Expand Down Expand Up @@ -1272,6 +1280,7 @@ hostnamectl set-hostname test # 修改 hostname 立即生效且重启也生效
```
```bash
service network restart
systemctl restart NetworkManager.service
systemctl restart NetworkManager # 重启网络管理
systemctl enable NetworkManager
```
Expand Down Expand Up @@ -1978,6 +1987,17 @@ curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
```

### opkg

> opkg 工具 (一个 ipkg 变种) 是一个用来从本地软件仓库或互联网软件仓库上下载并安装 OpenWrt 软件包的轻量型软件包管理器。
**基础使用**
```bash
opkg update # 更新可用软件包列表
opkg install xxxx # 安装一个或多个软件包
opkg remove xxxx # 移除一个或多个软件包
```

### 常用软件

**bash-insulter**
Expand Down Expand Up @@ -2324,10 +2344,10 @@ getenforce # 查看 selinux 状态
/usr/sbin/sestatus # 查看安全策略
```

**关闭 SELinux**
**关闭 SELinux**
- 需要重启
```vim
vim /etc/selinux/config
vim /etc/selinux/config

SELINUX=disabled
```
Expand Down
16 changes: 8 additions & 8 deletions 1earn/Integrated/Linux/实验/httpd.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ openssl genrsa 2048 > cakey.pem
openssl req -new -x509 -key cakey.pem > /etc/pki/CA/cacert.pem

cd /etc/pki/CA
touch index.txt # 索引问文件
touch index.txt # 索引文件
touch serial # 给客户发证编号存放文件
echo 01 > serial

Expand Down Expand Up @@ -321,21 +321,21 @@ firewall-cmd --reload
4. 配置 https 服务使原站点能使用 https 访问.
```bash
# 查看证书密钥位置
sed -n '/^SSLCertificateFile/p;/^SSLCertificateKeyFile/p '/etc/httpd/conf.d/ssl.conf
sed -n '/^SSLCertificateFile/p;/^SSLCertificateKeyFile/p '/etc/httpd/conf.d/ssl.conf

# 删除原来的密钥
cd /etc/pki/tls/private/
rm -f localhost.key
cd /etc/pki/tls/private/
rm -f localhost.key

# 新建密钥文件
openssl genrsa 1024 > localhost.key
openssl genrsa 1024 > localhost.key

# 删除原来的证书
cd ../certs
rm -rf localhost.crt
cd ../certs
rm -rf localhost.crt

# 新建证书文件
openssl req -new -x509 -days 365 -key ../private/localhost.key -out localhost.crt
openssl req -new -x509 -days 365 -key ../private/localhost.key -out localhost.crt

防火墙放行 https,重启服务,测试
```
Expand Down
64 changes: 32 additions & 32 deletions 1earn/Integrated/Linux/实验/nfs.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
yum -y install nfs-utils
```
```vim
vim /etc/exports
vim /etc/exports
/public 192.168.xxx.xxx(ro)
/public 192.168.xxx.xxx(ro)
```
```bash
mkdir /public
mkdir /public

vi /etc/selinux/config
vi /etc/selinux/config
SELINUX=disabled

firewall-cmd --zone=public --add-service=rpc-bind --permanent
Expand All @@ -34,36 +34,36 @@ service nfs start
- 访问使用 nfsuser1 进行访问(用户需要自己创建);
- 在 Centos 上挂载来自 Centos 的 nfs 共享,将共享目录挂载到 `/mnt/nfsfiles` ,启动时自动挂载.
```bash
yum -y install nfs-utils
yum -y install nfs-utils
mkdir /mnt/nfsfiles

useradd nfsuser1
passwd nfsuser1
useradd nfsuser1
passwd nfsuser1
```

验证共享是否成功 `showmount -e 192.168.xxx.xxx`
验证共享是否成功 `showmount -e 192.168.xxx.xxx`

挂载共享目录
```vim
vim /etc/fstab
192.168.xxx.xxx:/public /mnt/nfsfiles/ nfs defaults 0 0
192.168.xxx.xxx:/public /mnt/nfsfiles/ nfs defaults 0 0
```

`su -l nfsuser1`
`su -l nfsuser1`

**验证**

服务器
```bash
[root@localhost ~]# cd /public/
[root@localhost public]# echo "hello" > hello.txt
[root@localhost ~]# cd /public/
[root@localhost public]# echo "hello" > hello.txt
```

客户端
```bash
[nfsuser1@localhost ~]$ cd /mnt/nfsfiles/
[nfsuser1@localhost nfsfiles]$ cat hello.txt
[nfsuser1@localhost ~]$ cd /mnt/nfsfiles/
[nfsuser1@localhost nfsfiles]$ cat hello.txt
```

---
Expand All @@ -73,12 +73,12 @@ vim /etc/fstab
- 将主机 1 配置为 nfs 服务器,把 `/var/www/html` 作为共享目录,

```bash
yum -y install nfs-utils
yum -y install nfs-utils
```
```vim
vim /etc/exports
vim /etc/exports
/var/www/html 192.168.xxx.xxx(rw)
/var/www/html 192.168.xxx.xxx(rw)
```
```bash
firewall-cmd --zone=public --add-service=rpc-bind --permanent
Expand All @@ -95,7 +95,7 @@ systemctl enable nfs-server.service

- 将主机 2 配置为 nfs 客户端,并在其上查看共享目录,并挂载到本地目录 `/test`
```bash
mount.nfs 192.168.xxx.xxx:/var/www/html /test
mount.nfs 192.168.xxx.xxx:/var/www/html /test
```

- 同时将 /`test` 文件夹内容拷贝到主机 2 下的 `/home/www`,并创建一个归档备份
Expand Down Expand Up @@ -145,8 +145,8 @@ systemctl enable nfs-server.service

2. 将以上挂载的云硬盘格式化为 ext4 格式并挂载到 `/mnt` 目录上;
```bash
fdisk -l 查看磁盘情况
fdisk /dev/sdb 创建系统分区
fdisk -l 查看磁盘情况
fdisk /dev/sdb 创建系统分区
n
p
1
Expand All @@ -161,16 +161,16 @@ mount /dev/sdd1 /mnt/sdb1

3. 在主机2上发布共享 `/public` 目录(需自行创建)和 `/mnt` 目录,`/mnt` 目录允许所有用户访问,但不能写入,`/public` 目录允许 192.168.11.0/24 网段的用户读写.
```bash
yum -y install nfs-utils
yum -y install nfs-utils
```
```vim
vim /etc/exports
vim /etc/exports
/mnt *(ro)
/public 192.168.11.*(rw)
/public 192.168.11.*(rw)
```
```bash
mkdir /public
mkdir /public

firewall-cmd --zone=public --add-service=rpc-bind --permanent
firewall-cmd --zone=public --add-service=mountd --permanent
Expand All @@ -193,15 +193,15 @@ systemctl enable nfs-server.service
- 配置 NFS 服务,以读写访问方式将 `/data/web_data` 目录仅共享给 192.168.XX+1.0/24 网段的所有用户,且不挤压 root 用户的权限.

```bash
yum -y install nfs-utils
yum -y install nfs-utils
```
```vim
vim /etc/exports
vim /etc/exports
/data/web_data 192.168.XX+1.*(rw,no_root_squash)
/data/web_data 192.168.XX+1.*(rw,no_root_squash)
```
```bash
mkdir -p /data/web_data
mkdir -p /data/web_data

firewall-cmd --zone=public --add-service=rpc-bind --permanent
firewall-cmd --zone=public --add-service=mountd --permanent
Expand All @@ -220,7 +220,7 @@ systemctl enable nfs-server.service
- 配置 NFS 服务,将主机 A 共享的目录挂载至 `/data/web_data` 目录下.

```bash
yum -y install nfs-utils
yum -y install nfs-utils

firewall-cmd --zone=public --add-service=nfs --permanent
firewall-cmd --reload
Expand All @@ -231,9 +231,9 @@ systemctl enable rpcbind.service
systemctl enable nfs-server.service
```

验证共享是否成功 `showmount -e 192.168.xxx.xxx`
验证共享是否成功 `showmount -e 192.168.xxx.xxx`

```
mkdir -p /data/web_data
mount.nfs 192.168.xxx.xxx:/data/web_data /data/web_data
mkdir -p /data/web_data
mount.nfs 192.168.xxx.xxx:/data/web_data /data/web_data
```
Loading

0 comments on commit 9f82fde

Please sign in to comment.