CentOS7环境配置

2020-03-23  本文已影响0人  W11ng

CentOS7常用目录

 

HTTP加密工具htpasswd

# 安装
yum install -y httpd-tools

安装MySQL

下载MySQL

# 获取安装包
wget http://repo.mysql.com/mysql57-community-release-fc23-8.noarch.rpm
# 解压安装包
rpm -ivh http://repo.mysql.com/mysql57-community-release-fc23-8.noarch.rpm
# 安装mysql
yum install -y mysql mysql-server
# 查看原始密码
grep 'temporary password' /var/log/mysqld.log

进入mysql修改密码

set password for 'root'@'localhost'=password('CYYsql./0127');
flush privileges;

安装配置mongodb

  1. 源安装
# 添加MongoDB源
sudo vim /etc/yum.repos.d/mongodb-org.repo
# 添加内容并保存
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/7Server/mongodb-org/3.6/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc
# 安装
sudo yum install mongodb-org




wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.6.17.tgz
tar -zxvf mongodb-linux-x86_64-3.6.17.tgz 
mv mongodb-linux-x86_64-3.6.17/ /opt/mongodb
export PATH=/opt/mongodb/bin:$PATH

安装Nginx

# 添加源
sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
# 安装nginx
sudo yum install -y nginx

# 开启服务
sudo systemctl start nginx.service
sudo systemctl enable nginx.service

配置nginx,在http中添加如下:

http {
    server {
        listen 6801;
        location / {
            proxy_pass      http://127.0.0.1:6800/;
            auth_basic      "Restricted";
            auth_basic_user_file    /etc/nginx/conf.d/htpasswd;
        }
    }
}

安装Redis

# 添加EPEL仓库
sudo yum install epel-release
# 更新yum源
sudo yum update
# 安装Redis数据库
sudo yum -y install redis

对Redis进行配置

# 开启服务
sudo systemctl start redis
# 进入配置文件/etc/redis.conf或/etc/redis/redis.conf
sudo vim /etc/redis/redis.conf
# 注释掉下面这一行,允许远程连接
bind 127.0.0.1
# 取消注释下面这一样,原密码为Foobared,自行设置新密码
requirepass foobared
# 重启服务
sudo systemctl restart redis

安装Python3.6

安装编译环境

sudo yum -y groupinstall "Development tools"
sudo yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel

下载python3.6包

wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz
# 解压包
tar -xvf Python-3.6.8.tar.xz

安装

cd Python-3.6.8

# 生成MakeFile
sudo ./configure --prefix=/usr/local/python3.6.8 --enable-optimizations

# 安装 使用make atinstall避免替换默认的python执行文件
sudo make altinstall

设置软链接

sudo ln -s /usr/local/python3.6.8/bin/python3.6 /usr/bin/python3
sudo ln -s /usr/local/python3.6.8/bin/pip3.6 /usr/bin/pip3

更新pip

mkdir ~/.pip
cd ~/.pip
vim pip.conf

修改pip源

[global]
index-url=http://mirrors.aliyun.com/pypi/simple/

[install]
trusted-host=mirrors.aliyun.com

21. 软件安装

Linux的软件是通过GPL授权,能自己通过源码解决bug或修改软件内容,但Windows的软件是商家封装完,即使内置广告也无可奈何。

查看是否是可执行文件file

file /bin/bash
上一篇下一篇

猜你喜欢

热点阅读