LNMP环境一键部署

LNMP环境一键部署

Posted by liu kai on October 28, 2019

LNMP环境一键部署

wget -c http://mirrors.linuxeye.com/oneinstack-full.tar.gz && tar xzf oneinstack-full.tar.gz && ./oneinstack/install.sh --nginx_option 1 --php_option 8 --phpcache_option 1 --php_extensions sourceguardian,imagick,fileinfo,imap,redis,memcached,memcache,mongodb,swoole --db_option 2 --dbinstallmethod 1 --dbrootpwd oneinstack --redis --memcached --iptables --ssh_port 22 --reboot

oneinstack一键安装

端口开放

执行下 netstat -tnlp

执行下sudo ufw status

打开iptables 3306端口

如果您的操作系统为CentOS系列:

iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT

service iptables save

数据库授权

注意⚠️:远程连接新建一个帐号(帐号名不能为root)

如:添加一个用户名为db_user,密码为db_pass,授权为% (%表示所有IP能连接)对db_name数据库所有权限,命令如下:

MySQL8.0版本

mysql -uroot -p

create user db_user@'%' identified by 'password'; #创建用户

grant all privileges on db_name.* to db_user@'%' with grant option; #授权

exit; #退出数据库控制台,特别注意有分号

其余MySQL版本

mysql -uroot -p

grant all privileges on db_name.* to db_user@'%' with grant option; #授权

flush privileges;

exit; #退出数据库控制台,特别注意有分号

操作系统命令

shutdown -r now #计算机会立刻重启

shutdown -r +10 #计算机会将于10分钟后重启

reboot #重启

halt #关机

秘钥:ssh-keygen

centos7安装zsh配置oh-my-zsh

echo $SHELL

返回结果:

bin/bash

安装zsh

yum install -y zsh

设置默认shell

chsh -s /bin/zsh

安装oh-my-zsh(自动)

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

修改主题: agnoster

完成后,重启生效默认shell reboot

下载composer.phar

curl -sS https://getcomposer.org/installer | php

mv composer.phar /usr/local/bin/composer

CentOS 安装 node.js

从EPEL库安装Node.js

安装Node.js的一个有效且简单的方法就是从官方库下载安装,首先确保您可以访问到EPEL库,您可以通过运行以下命令来安装

sudo yum install epel-release

sudo yum install nodejs