ubuntu lnmn 安装

一,创建用户,赋予root权限

1
2
3
4
5
6
adduser name
chmod u+w /etc/sudoers
vi /etc/sudoers
#添加如下字段
ybfq ALL=(ALL:ALL) ALL
chmod u-w /etc/sudoers

二,安装nginx

1
2
apt update
apt install nginx

三,安装nodejs npm yarn

1
2
3
4
5
6
7
8
9
10
11
12
13
# 安装apt 源
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
## Run `sudo apt-get install -y nodejs` to install Node.js 12.x and npm
# 安装 nodejs
sudo apt-get install -y nodejs
# 安装yarn, 这个在安装完成nodejs后会有提示说明怎么安装,如下
## Run `sudo apt-get install -y nodejs` to install Node.js 12.x and npm
## You may also need development tools to build native addons:
sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn

四,安装mysql

1
2
3
4
5
6
7
8
9
10
sudo apt mysql-server
#可以查看安装包
dpkg -l |grep mysql
# 进入到mysql
cd /etc/mydql
sudo cat debian.cnf
# 根据打印的用户名密码进行登录
mydql -u username -p ***

use mysql;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 执行命令切换到mysql 数据库
use mysql;
update user set authentication_string='' where user='root' and host="localhost";
flush privileges;
alter user 'root'@'localhost' identified by 'password';
exit;

#创建数据库
create database sina default character set utf8mb4 collate utf8mb4_unicode_ci;
#创建用户
create user 'user'@'%' identifiedby 'password';
#给用户赋权限
GRANT ALL PRIVILEGES ON sina.* TO 'user'@'%' WITH GRANT OPTION;
flush privileges;