概述
一,mysql安装
0,上传安装包至目录:/data/software/mysql
1,解压包
cd /data/software/mysql
tar -xvf mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar
2,rpm安装
rpm2cpio mysql-community-common-5.7.28-1.el7.x86_64.rpm |cpio -idvm
rpm2cpio mysql-community-libs-5.7.28-1.el7.x86_64.rpm |cpio -idvm
rpm2cpio mysql-community-client-5.7.28-1.el7.x86_64.rpm |cpio -idvm
rpm2cpio mysql-community-server-5.7.28-1.el7.x86_64.rpm |cpio -idvm
rpm2cpio mysql-community-devel-5.7.28-1.el7.x86_64.rpm |cpio -idvm
3,修改my.cnf
vi /data/software/mysql/etc/my.cnf
添加或修改文件内容:
datadir=/data/software/mysql/var/lib/data
socket=/data/software/mysql/var/lib/mysql/mysql.sock
log-error=/data/software/mysql/var/log/mysqld.log
pid-file=/data/software/mysql/var/run/mysqld/mysqld.pid
basedir=/data/software/mysql/usr
secure-file-priv=/data/software/mysql/var/lib/mysql-files
#字符集设置
character-set-server=utf8
init_connect='SET NAMES utf8’
#大小写不敏感
lower_case_table_names=1
sql-mode=STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
log-bin-trust-function-creators=1
4,新建目录
mkdir /data/software/mysql/var/log
mkdir /data/software/mysql/var/lib/data
// 5,在当前用户下配置环境变量
// echo ‘export PATH=$PATH:/data/software/mysql/usr/bin/:/data/software/mysql/usr/sbin/’ >> /home/app/.bashrc
// source /home/app/.bashrc
6,初始化mysql数据库
cd /data/software/mysql/usr/sbin
./mysqld --defaults-file=/data/software/mysql/etc/my.cnf --initialize
7,启动mysql
cd /data/software/mysql/usr/sbin
./mysqld --defaults-file=/data/software/mysql/etc/my.cnf &
8,查看3306端口
netstat -nl | grep 3306
9,获取初始密码
grep password /data/software/mysql/var/log/mysqld.log
形式如下:
[Note] A temporary password is generated for root@localhost: d7rWnBEqa+qp
d7rWnBEqa+qp 就是密码
10,登录root
cd /data/software/mysql/usr/bin
./mysql -u root -p -S /data/software/mysql/var/lib/mysql/mysql.sock
11,修改密码
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘mysql@123’;
12,开通访问权限
grant all privileges on *.* to ‘root’@’%’ identified by ‘mysql@123’;
13,刷新权限
flush privileges;
14,开放3306端口(这个需要sudo权限)
sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent
sudo firewall-cmd --reload
或者关闭防火墙(重启失效)
sudo systemctl stop firewalld
15,关闭mysql
cd /data/software/mysql/usr/bin
./mysqladmin -u root -p shutdown -S /data/software/mysql/var/lib/mysql/mysql.sock
16,设置数据库最大连接数(非常重要!!!)
查询最大连接数
show variables like ‘%max_connections%’;
设置最大连接数,立即生效,重启失效
set GLOBAL max_connections=10000;
查询当前连接数
show status like ‘Threads%’;
查看当前连接情况
show full processlist;
二,redis 安装
1,解压包
tar -zxvf redis-5.0.0.tar.gz
2,进入解压文件夹执行编译
cd redis-5.0.0
make
3,安装编译结果到指定目录
make install PREFIX=/data/software/redis/redis-5.0.0
4,编辑reids.conf文件
vi redis.conf
修改文件内容:
daemonize yes
pidfile /data/software/redis/redis-5.0.0/redis_6379.pid
logfile “/data/software/redis/redis-5.0.0/redis_6379.log”
dir /data/software/redis/redis-5.0.0/
requirepass redis@scjk
5,bin文件夹下启动redis
cd /data/software/redis/redis-5.0.0/bin
./redis-server /data/software/redis/redis-5.0.0/redis.conf
6,查看redis是否启动
ps -aux|grep redis
7,简单验证
./redis-cli
auth redis@scjk
set a 1
get a
8,关闭redis
./redis-cli -a redis@scjk shutdown
三,nginx 安装
1,解压包
tar -zxvf nginx-1.18.0.tar.gz
2,创建文件
mkdir /data/software/nginx/nginx-1.18.0/nginx
3,指定配置
./configure --prefix=/data/software/nginx/nginx-1.18.0/nginx
4,编译及安装
make && make install
5,更改默认80端口(Linux只有root用户可以使用1024一下的端口)
cd /data/software/nginx/nginx-1.18.0/nginx/conf
vi nginx.conf
将80端口改为1024以上端口
6,启动nginx
cd /data/software/nginx/nginx-1.18.0/nginx/sbin
./nginx
7,关闭nginx
cd /data/software/nginx/nginx-1.18.0/nginx/sbin
./nginx -s quit
8,常见问题
./nginx: error while loading shared libraries: libpcre.so.0: cannot open shared object file: No such file or directory
查询依赖
ldd $(which /opt/nginx/nginx-1.18.0/nginx/sbin/nginx)
linux-vdso.so.1 (0x00007fff5f7ef000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f8f5f808000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f8f5f5eb000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f8f5f3b0000)
libpcre.so.0 => not found
libz.so.1 => /usr/local/lib/libz.so.1 (0x00007f8f5f195000)
libc.so.6 => /lib64/libc.so.6 (0x00007f8f5edf2000)
/lib64/ld-linux-x86-64.so.2 (0x00007f8f5fa0c000)
建立软件连接
ln -s /usr/local/lib/libpcre.so.0 /lib64
四,rabbitMQ安装(rpm方式,这个是root安装)
1,解压包
sudo rpm -ivh erlang-18.3-1.el7.centos.x86_64.rpm
sudo rpm -ivh socat-1.7.3.2-5.el7.lux.x86_64.rpm
sudo rpm -ivh rabbitmq-server-3.6.5-1.noarch.rpm
2,修改配置
sudo vi /usr/lib/rabbitmq/lib/rabbitmq_server-3.6.5/ebin/rabbit.app
修改内容:
{default_user, <<“admin”>>},
{default_pass, <<“123456”>>}
(注意:rabbitmq-env.conf这个文件没有,打开之后自动创建)
sudo vi /etc/rabbitmq/rabbitmq-env.conf
添加
NODENAME=rabbit@localhost
RABBITMQ_LOG_BASE=/var/log/rabbitmq
3,启动
sudo rabbitmq-server -detached
4,关闭
sudo rabbitmqctl stop
// 5,初始化添加队列
// yusp-flow.demo
// yusp-flow.exception
// yusp-flow.standard_approval
四,rabbitMQ安装(解压包方式,root用户下操作)
1,解压erlang包,进目录安装
./configure
2,编译并注册应用 (make 时间有点长)
make
make install
3,解压rabbitmq包
tar -zxvf xxx.tar
4,配置rabbitmq环境变量:
vim /etc/profile
添加内容:
export PATH=$PATH:/opt/rabbitmq/rabbitmq_server-3.2.4/sbin
配置立即生效:source /etc/profile
5,主机名称
vim /etc/hosts
添加内容
127.0.0.1 主机名称
6,启动mq
rabbitmq-server -detached
7,查看mq状态
rabbitmqctl status
8,查看mq用户
rabbitmqctl list_users
9,添加用户并授权
rabbitmqctl add_user admin 123456
rabbitmqctl set_user_tags admin administrator,
rabbitmqctl set_permissions -p “/” admin “." ".” “.*”
10,停止mq
rabbitmqctl stop
五,其他相关
1,mysql创建用户及初始化数据
创建dataman用户及赋权
create user ‘dataman’@’%’ identified by ‘dataman@123’;
赋权限
grant all privileges on *.* to ‘dataman’@’%’ identified by ‘dataman@123’;
刷新权限
flush privileges;
登录dataman用户
cd /data/software/mysql/usr/bin
./mysql -u dataman -p -S /data/software/mysql/var/lib/mysql/mysql.sock
创建数据库
create database data_metadata_common;
create database data_metadata;
create database data_standard;
create database data_qa;
create database data_datasource;
create database data_asset;
show databases;
导入初始数据
use data_metadata_common;
source /data/software/sql/data_metadata_common.sql;
use data_metadata;
source /data/software/sql/data_metadata.sql;
use data_standard;
source /data/software/sql/data_standard.sql;
use data_qa;
source /data/software/sql/data_qa.sql;
use data_datasource;
source /data/software/sql/data_datasource.sql;
use data_asset;
source /data/software/sql/data_asset.sql;
2,nginx 配置
vi nginx.conf
修改或添加文件内容:
upstream gateway {
server 10.10.0.76:17001;
}
location /web {
root /data/software;
index index.html index.htm;
}
location / {
proxy_set_header Host $host:8000; #非默认端口时(80),指定具体端口
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://gateway;
}
3,常用命令
开放端口
sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent
sudo firewall-cmd --reload
或者关闭防火墙(重启失效)
sudo systemctl stop firewalld
scp
拷贝目录
scp -r /data/dataman/web app@10.10.0.202:/data/software/web
拷贝文件
scp /data/dataman/datas/yusys-dataqa-server.jar app@10.10.0.202:/data/dataman/datas
查看linux系统版本
cat /etc/issue
最后
以上就是威武小海豚为你收集整理的非root用户安装mysql一,mysql安装二,redis 安装三,nginx 安装四,rabbitMQ安装(rpm方式,这个是root安装)四,rabbitMQ安装(解压包方式,root用户下操作)五,其他相关的全部内容,希望文章能够帮你解决非root用户安装mysql一,mysql安装二,redis 安装三,nginx 安装四,rabbitMQ安装(rpm方式,这个是root安装)四,rabbitMQ安装(解压包方式,root用户下操作)五,其他相关所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复