在 CentOS7 里安装 openssh-7.9p1

CentOS 7.5的openssh版本是 openssh-7.4p1-16.el7.x86_64,如需使用 openssh-7.9p1 版本,可参考下列。

过程:

1.先安装新版本的openssl,如openssl-1.1

2.yum install -y pam-devel openssl-devel # 安装相应的组件

3.wget https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.9p1.tar.gz # 下载安装文件

4.tar xzvf openssh-7.9p1.tar.gz # 解压

5.cd openssh-7.9p1 # 进到文件目录

6../configure -prefix=/usr -sysconfdir=/etc/ssh -with-md5-passwords -with-pam -with-ssl-dir=/usr/include/openssl -without-hardening # 配置

7.make # 编译

8.mv /etc/ssh /etc/ssh-bak # 移走现有的ssh配置目录

9.make install # 安装

10.echo "PermitRootLogin yes" >> /etc/ssh/sshd_config # 允许root用户远程登录

11.cp contrib/redhat/sshd.init /etc/init.d/sshd # 复制sshd启动文件

12.chmod +x /etc/init.d/sshd # 给执行权限

13.chkconfig --add sshd # 添加服务

14.chkconfig sshd on # 设置自动启动

15.vi /usr/lib/systemd/system/sshd.service # 编辑配置文件,注释掉相关行,禁止自动启动,因为发现安装新版本openssh后,日志不断记录启动失败和自动启动

[Unit]
Description=OpenSSH server daemon
Documentation=man:sshd(8) man:sshd_config(5)
# After=network.target sshd-keygen.service
# Wants=sshd-keygen.service
After=network.target

[Service]
# Type=notify
# EnvironmentFile=/etc/sysconfig/sshd
# ExecStart=/usr/sbin/sshd -D $OPTIONS
ExecStart=/usr/sbin/sshd
# ExecReload=/bin/kill -HUP $MAINPID
# KillMode=process
# Restart=on-failure
# RestartSec=42s

[Install]
WantedBy=multi-user.target

16.systemctl daemon-reload # 重载服务

17./etc/init.d/sshd restart # 重启sshd服务

参考:

在CentOS 7 安装 OpenSSL 1.1.1a

CentOS7.5里的openssl版本是 OpenSSL 1.0.2k-fips 26 Jan 2017 ,如需较新版本的,可自行尝试下载安装。

过程:

1.yum install libtool perl-core zlib-devel -y # 安装相应的组件

2.wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1a.tar.gz # 下载安装文件包

3.tar xzvf OpenSSL_1_1_1a.tar.gz # 解压

4.cd openssl-OpenSSL_1_1_1a # 转到文件包目录

5../config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl shared zlib # 配置

6.make

7.make install

8.vi /etc/profile.d/openssl.sh # 创建openssh配置文件,使用新版本的openssl,不直接替换原有的

# /etc/profile.d/openssl.sh
pathmunge /usr/local/openssl/bin

9.vi /etc/ld.so.conf.d/openssl-1.1.conf # 创建lib配置文件

/etc/ld.so/conf.d/openssl-1.1.conf

/usr/local/openssl/lib

10.ldconfig -v # 让openssh新版本lib路径生效

参考:https://blacksaildivision.com/how-to-install-openssl-on-centos

升级mysql5.5到mysql5.7,查询警告 - this is incompatible with sql_mode=only_full_group_by

问题:升级mysql到5.7,导入mysql5.5的数据库,站点日志中,有类似 this is incompatible with sql_mode=only_full_group_by 的警告。

解决:在mysql的配置文件mysql.ini里加sql_mode的参数,如下边的内容:

[mysqld]
sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

原因可能是新版本的mysql5.7与原sql查询语句不“兼容”。

参考:https://stackoverflow.com/questions/34115174/error-related-to-only-full-group-by-when-executing-a-query-in-mysql

“跳启” - 乡村剃头匠

我在农村长大的,老家到街上约有“半趟路”(约有五公里),大人们平时忙农活,没时间赴街(赶集),所以有各种“走江湖”,有挑担来收牙膏收烂铁换角牙糖或凉鞋的,有带着电火(手电筒)头来照鸡蛋收鸡蛋的,有背包来剃头(理发)的。

较常来我们屋剃头的,是“跳启”,因为他有只脚有疾,走路慢,肩膀一上一下,小孩淘气地喊“跳启”,他也不生气。每每他进来大屋,一般会找个较宽敞的下厅,向吖公借张有靠背的高凳,在靠背的边顶上用力钉上他的刮刀布条,然后先给长者,年纪较大的剃头。“跳启”的手艺好,且能说会道。嘴一边天南地北地说,手一边熟练地一张一合地推发,咔嚓咔嚓。甚至有时他还会唱起山歌来,逗得老人小孩都哈哈笑。“跳启”风趣讲笑话,来剃头的坐着不枯燥,有时头剃完了,但笑话还没听完,坐在高凳上不愿起来,下一个端着盛有热水的面盆赶忙来催。

之后,我上了城,见不到“跳启”了,觉得“东风理发室”里的师傅比不上他,那没人讲笑话。城里理发室是很大,凳子还可以放得躺下人来的,没轮到的客户也可以坐在长条凳子上等。但我觉得那整齐得生冷,陌生。有次,我在那等得久了还没轮到我理发,哭了。

前几天,无意中想到“跳启”,问起来,听说“跳启”较早就没走村理发,在街心开了间发室,不仅养鱼塘致富且娶到了一个漂亮的老婆,应该是过上了新时代的幸福生活。

在 OpenLiteSpeed 里新建wordpress站点

环境,debian9, OpenLiteSpeed 1.14.40

过程:

1.在“虚拟主机”菜单里,添加新站
open-lite-speed-5.png

2.本例,“虚拟主机名”为 szt.anqun.org,根目录为 $SERVER_ROOT/szt.anqun.org,配置文件可点击创建
open-lite-speed-6.png

3.常规里,设置“文档根”为 html,即wordpress的文件全部放在这,如同常用的public_html目录
open-lite-speed-7.png

4.本例是额外安装了php7.2,所以“外部应用程序”里,有添加lsphp72
open-lite-speed-8.png

5.这是lsphp72的设置详情,关键是“命令”要填写实际值,如本例是 $SERVER_ROOT/lsphp72/bin/lsphp
open-lite-speed-9.png

6.“脚本处理器”里添加php的后缀,处理器名称即是前一页设置的lsphp72
open-lite-speed-10.png

7.“重写”里“启用重写”和“自动加载.htaccess”选择“是”
open-lite-speed-11.png

8.“模块”里添加cache模块,参数如下:

enableCache 0
qsCache 1
reqCookieCache 1
respCookieCache 1
ignoreReqCacheCtrl 1
ignoreRespCacheCtrl 0
enablePrivateCache 0
privateExpireInSeconds 1000
expireInSeconds 1000
storagePath cachedata
checkPrivateCache 1
checkPublicCache 1

open-lite-speed-16.png

9.转到主菜单里的“监听器”,添加443端口,如本例设置的监听器名称为“web-443”,且启用“加密连接”
open-lite-speed-12.png

10.“虚拟主机映射”里添加相应的虚拟主机,本例是szt.anqun.org
open-lite-speed-13.png

11.“SSL”里填写私匙和证书文件的路径,本例是 $SERVER_ROOT/szt.anqun.org/szt.anqun.key
open-lite-speed-14.png

12.在浏览器完成wordpress的安装,本例wordpress首页文件的绝对路径应该是:/usr/local/lsws/szt.anqun.org/html/index.php
open-lite-speed-15.png

13.登录到wordpress后台,安装litespeed的插件,启用
open-lite-speed-17.png

14.退出wordpress登录状态,访问测试,查看响应头,有x-litespeed-cache-control的相关信息
open-lite-speed-18.png

15.有时在litespeed的管理界面会出现404的错误
open-lite-speed-19.png

参考: