Centos 配置服务器

Centos 配置服务器

(配置服务器 除了Git Bash Here 还可以安装Xshell 网址:https://xshell.en.softonic.com/

Wincp 网址:https://winscp.net/eng/docs/lang:chs)

一.Nginx 安装

1.yum install -y gcc-c++pcre pcre-develzlib zlib-developenssl openssl-devel

2.wget http://nginx.org/download/nginx-1.18.0.tar.gz

3.tar zxvf nginx-1.18.0.tar.gz

4.cd nginx-1.18.0

5. ./configure --prefix=/usr/local/nginx

6. make&&make install

7.启动

cd /usr/local/nginx/sbin

./nginx

8.查看启动状态

通过端口查询: lsof -i:80 #nginx默认是80端口
通过进程查询: ps -ef | grep nginx
访问网页查询 curl 127.0.0.1
9.配置文件详情

进入配置文件

        cd /usr/local/nginx/conf/

         vi nginx.conf

在 nginx.conf 的注释符号为: #

… #全局块 events { #events块 … } http #http块 { … #http全局块 server #server块 { … #server全局块 location [PATTERN] #location块 { … } location [PATTERN] { … } } server { … } … #http全局块 }
#修改完成后,重新加载配置文件
cd /usr/local/nginx/sbin/

./nginx -s reload

root指路径
server_name 域名

二.node安装

1.运行Node.js安装程序脚本
下载并执行脚本:

$ sudo yum -y install curl
$ curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash -
2.在CentOS 8/7、RHEL 8/7系统上安装Node.js 14版本及以上版本

RHEL 8上的安装与基于RHEL 7的Linux发行版上的安装相同,唯一的区别是,Node.js AppStream存储库已在RHEL/CentOS 8系统上被安装脚本禁用,如果您要安装AppStream版本的Node.js,则需要启用它:

sudo yum install -y nodejs
3.验证是否安装成功
验证node:$ node -v

返回信息:验证 npm $ npm -v
4.安装 Yarn 程序包管理器

$curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
// 安装包

$sudo yum install yarn

5.如果需要为Node.js构建本机加载项,请考虑安装开发工具,运行如下命令:

$ sudo yum install gcc-c++ make

三.Mysql

首先查看:rpm -qa|grep -i mysql

删除操作(一个一个删除):yum remove ‘软件名’

如果无法执行wget命令,则先安装wget:

yum -y install wget
下载MySql:

wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
安装MySql:

yum localinstall mysql57-community-release-el7-11.noarch.rpm
查看是否安装成功:

yum repolist enabled | grep “mysql.-community.

安装mysql:

yum install mysql-community-server
启动mysql:

systemctl start mysqld
关闭mysql:

systemctl stop mysqld
查看是否启动:

systemctl status mysqld
重启mysql:

systemctl restart mysqld

设置开机自启:

systemctl enable mysqld
继续执行:

systemctl daemon-reload

查看默认密码:

grep ‘temporary password’ /var/log/mysqld.log
连接数据库:

mysql -u root -p 密码
Mysql密码有安全策略,在/etc/my.cnf中加入 validate_password = off 可以设置关闭密码检验

重启mysql:

systemctl restart mysqld
进入mysql之后,修改密码:

alter user ‘root’@‘localhost’ identified by ‘新密码’;
(6)远程连接

远程连接设置:

grant all privileges on . to root@'%'identified by ‘数据库密码’;
连接成功

  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

码上流星&洒下星辰

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值