yum install -y epel-release yum install -y nginx
Debian 9 安装 ZooKeeper
sudo apt install zookeeperd sudo systemctl enable zookeeper sudo systemctl restart zookeeper
root@stretch:/var/lib/zookeeper# /usr/share/zookeeper/bin/zkCli.sh
Connecting to localhost:2181
Welcome to ZooKeeper!
JLine support is enabled
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
[zk: localhost:2181(CONNECTED) 0] ls / [zookeeper] [zk: localhost:2181(CONNECTED) 1]
[zk: localhost:2181(CONNECTED) 0] create /config.json {} Created /config.json [zk: localhost:2181(CONNECTED) 1]
[zk: localhost:2181(CONNECTED) 0] get /config.json {} cZxid = 0xb ctime = Fri Apr 03 17:27:50 GMT+00:00 2020 mZxid = 0xb mtime = Fri Apr 03 17:27:50 GMT+00:00 2020 pZxid = 0xb cversion = 0 dataVersion = 0 aclVersion = 0 ephemeralOwner = 0x0 dataLength = 2 numChildren = 0 [zk: localhost:2181(CONNECTED) 1]
[zk: localhost:2181(CONNECTED) 0] delete /config.json [zk: localhost:2181(CONNECTED) 1]
macOS Catalina 安装 deployer
brew install deployer
解决 macOS zsh ssh 乱码
最近使用 macOS zsh ssh 登录远程服务器时候,终端会出现如下提示内容:
-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
显示中文字符时会不规则的乱码,有些字符乱,有些字符不乱
解决办法是编辑 ~/.zshrc 文件,手动设置一下终端环境的语言编码:
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
Laravel 的 3 种运行环境
Laravel 可以在通过 APP_ENV 环境变量修改运行时环境,默认的 APP_ENV 是 local,其实他还可以设置其他值,分别是:
local 对应的 development 环境
testing 对应的 test 环境
production 对应的 production 环境
使 PHPUnit 支持 Session
当使用PHPUnit
测试的PHP
代码中包含session_start()
时,就会出现以下的错误提示:
PHPUnit 4.8.36 by Sebastian Bergmann and contributors. E Time: 110 ms, Memory: 12.00MB There was 1 error: 1) ExampleTest::testBasicExample ErrorException: session_start(): Cannot start session when headers already sent
解决办法是打开phpunit.xml
文件,设置processIsolation
属性为true
CentOS 7 安装 Tomcat 8
网上有很多 CentOS 7 安装 Tomcat 8 教程,都是从 Apache 官网下载二进制包后解压启动,随意性太强。没有通过系统包管理来维护是不完美的。
yum install https://harbottle.gitlab.io/harbottle-main/7/x86_64/harbottle-main-release.rpm
yum install tomcat8
systemctl enable tomcat8
systemctl restart tomcat8
部署的时候把 war 文件放到 /var/lib/tomcat8/webapps 目录下即可。
树莓派禁用 swapfile
sudo dphys-swapfile swapoff sudo dphys-swapfile uninstall sudo systemctl disable dphys-swapfile
使用 rlwrap 解决 SQL*Plus 上下键问题
SQL*Plus 默认执行完之后,按上下左右键效果是上图的样子,非常不爽。
yum install -y epel-release
yum install -y rlwrap
之后使用 rlwrap sqlplus 来启动,效果就非常完美了
Ubuntu 18.04 安装 Docker 环境
snap install docker
配置文件位置是在
/var/snap/docker/current/config/daemon.json
{
"registry-mirrors": ["https://registry.docker-cn.com"],
"log-level": "error",
"storage-driver": "aufs"
}