diff --git "a/1earn/Develop/Web/\347\254\224\350\256\260/\350\256\244\350\257\201&\346\216\210\346\235\203.md" "b/1earn/Develop/Web/\347\254\224\350\256\260/\350\256\244\350\257\201&\346\216\210\346\235\203.md" index 974245af..04072697 100644 --- "a/1earn/Develop/Web/\347\254\224\350\256\260/\350\256\244\350\257\201&\346\216\210\346\235\203.md" +++ "b/1earn/Develop/Web/\347\254\224\350\256\260/\350\256\244\350\257\201&\346\216\210\346\235\203.md" @@ -243,9 +243,9 @@ Registered claims 有特殊含义,比如 iat、exp 等,iat 表示 JWT 生成 ```json { - "sub": "123456789", - "name": "shiroshiro", - "admin": false + "sub": "123456789", + "name": "shiroshiro", + "admin": false } ``` diff --git a/1earn/Integrated/Linux/Power-Linux.md b/1earn/Integrated/Linux/Power-Linux.md index 5590a884..4507627d 100644 --- a/1earn/Integrated/Linux/Power-Linux.md +++ b/1earn/Integrated/Linux/Power-Linux.md @@ -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
@@ -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 diff --git a/1earn/Integrated/Linux/Secure-Linux.md b/1earn/Integrated/Linux/Secure-Linux.md index c0d5e744..91a314d7 100644 --- a/1earn/Integrated/Linux/Secure-Linux.md +++ b/1earn/Integrated/Linux/Secure-Linux.md @@ -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 ``` diff --git a/1earn/Integrated/Linux/Speed-Linux.md b/1earn/Integrated/Linux/Speed-Linux.md index 59909a5f..1748dd64 100644 --- a/1earn/Integrated/Linux/Speed-Linux.md +++ b/1earn/Integrated/Linux/Speed-Linux.md @@ -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 @@ -1272,6 +1280,7 @@ hostnamectl set-hostname test # 修改 hostname 立即生效且重启也生效 ``` ```bash service network restart + systemctl restart NetworkManager.service systemctl restart NetworkManager # 重启网络管理 systemctl enable NetworkManager ``` @@ -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** @@ -2324,10 +2344,10 @@ getenforce # 查看 selinux 状态 /usr/sbin/sestatus # 查看安全策略 ``` -**关闭 SELinux** +**关闭 SELinux** - 需要重启 ```vim - vim /etc/selinux/config + vim /etc/selinux/config SELINUX=disabled ``` diff --git "a/1earn/Integrated/Linux/\345\256\236\351\252\214/httpd.md" "b/1earn/Integrated/Linux/\345\256\236\351\252\214/httpd.md" index bca12273..dee57f6e 100644 --- "a/1earn/Integrated/Linux/\345\256\236\351\252\214/httpd.md" +++ "b/1earn/Integrated/Linux/\345\256\236\351\252\214/httpd.md" @@ -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 @@ -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,重启服务,测试 ``` diff --git "a/1earn/Integrated/Linux/\345\256\236\351\252\214/nfs.md" "b/1earn/Integrated/Linux/\345\256\236\351\252\214/nfs.md" index f6c90145..0c7d384a 100644 --- "a/1earn/Integrated/Linux/\345\256\236\351\252\214/nfs.md" +++ "b/1earn/Integrated/Linux/\345\256\236\351\252\214/nfs.md" @@ -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 @@ -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 ``` --- @@ -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 @@ -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`,并创建一个归档备份 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 ``` diff --git "a/1earn/Integrated/Linux/\345\256\236\351\252\214/samba.md" "b/1earn/Integrated/Linux/\345\256\236\351\252\214/samba.md" index 18487148..672f6189 100644 --- "a/1earn/Integrated/Linux/\345\256\236\351\252\214/samba.md" +++ "b/1earn/Integrated/Linux/\345\256\236\351\252\214/samba.md" @@ -15,13 +15,13 @@ yum -y install samba ``` ```vim -vim /etc/samba/smb.conf +vim /etc/samba/smb.conf [smbshare] - path = /smbshare - public = yes + path = /smbshare + public = yes writeable=yes - hosts allow = 192.168.xx. + hosts allow = 192.168.xx. hosts deny = all ``` @@ -29,29 +29,29 @@ vim /etc/samba/smb.conf 添加用户,设置密码 ```bash -useradd smb1 -smbpasswd -a smb1(密码:smb123456) +useradd smb1 +smbpasswd -a smb1(密码:smb123456) ``` -将用户添加到 samba 服务器中,并设置密码 +将用户添加到 samba 服务器中,并设置密码 ```bash -pdbedit -a smb1(密码:smb123456) +pdbedit -a smb1(密码:smb123456) ``` -查看 samba 数据库用户 +查看 samba 数据库用户 ```bash -pdbedit -L +pdbedit -L ``` 创建共享目录,设置所有者和所属组 ```bash -mkdir /smbshare -chown smb1:smb1 /smbshare +mkdir /smbshare +chown smb1:smb1 /smbshare ``` -关闭 selinux(需要重启) +关闭 selinux(需要重启) ```vim -vim /etc/selinux/config +vim /etc/selinux/config SELINUX=disabled ``` @@ -59,7 +59,7 @@ SELINUX=disabled firewall-cmd --zone=public --add-service=samba --permanent firewall-cmd --reload -systemctl restart smb +systemctl restart smb ``` --- @@ -79,27 +79,27 @@ systemctl restart smb yum -y install samba ``` ```vim -vim /etc/samba/smb.conf +vim /etc/samba/smb.conf [global] workgroup = WORKGROUP [webdata] - path = /data/web_data - public = yes + path = /data/web_data + public = yes writable=yes - hosts allow = 192.168.1xx.33/32 + hosts allow = 192.168.1xx.33/32 hosts deny = all ``` ```bash testparm useradd -s /sbin/nologin apache -smbpasswd -a apache(密码:smb123456) -pdbedit -a apache(密码:smb123456) -pdbedit -L +smbpasswd -a apache(密码:smb123456) +pdbedit -a apache(密码:smb123456) +pdbedit -L -mkdir /data/web_data +mkdir /data/web_data cd /data/web_data/ setfacl -m u:apache:rwx . getfacl /deta/web_data/ @@ -111,7 +111,7 @@ setenforce 0 firewall-cmd --zone=public --add-service=samba --permanent firewall-cmd --reload -systemctl start smb +systemctl start smb ``` @@ -121,7 +121,7 @@ systemctl start smb ```bash yum -y install samba -mkdir /data/web_data +mkdir /data/web_data mount -t cifs -o username=apache,password='123' //192.168.xx+1.xx/webdata /data/web_data ``` @@ -144,28 +144,28 @@ mount -t cifs -o username=apache,password='123' //192.168.xx+1.xx/webdata /data/ yum -y install samba ``` ```vim -vim /etc/samba/smb.conf +vim /etc/samba/smb.conf [global] workgroup = WORKGROUP [webdata] - path = /data/web_data - public = yes + path = /data/web_data + public = yes writable=yes - hosts allow = 192.168.xx+1. + hosts allow = 192.168.xx+1. hosts deny = all - create mask = 0770 + create mask = 0770 ``` ```bash testparm useradd apache -smbpasswd -a apache(密码:123) -pdbedit -a apache(密码:123) -pdbedit -L +smbpasswd -a apache(密码:123) +pdbedit -a apache(密码:123) +pdbedit -L -mkdir /data/web_data +mkdir /data/web_data cd /data/web_data/ ``` @@ -174,7 +174,7 @@ cd /data/web_data/ setenforce 0 firewall-cmd --zone=public --add-service=samba --permanent firewall-cmd --reload -systemctl start smb +systemctl start smb ``` **客户端** @@ -183,6 +183,6 @@ systemctl start smb ```bash yum -y install samba -mkdir /data/web_data +mkdir /data/web_data mount -t cifs -o username=apache,password='123' //192.168.xx+1.xx/webdata /data/web_data ``` \ No newline at end of file