银河麒麟V10(Kylin Linux Advanced Server V10 (Tercel))安装Python3.8、MySQL5.7、Redis

文章目录

  • 前言
  • 一 安装Python3.8
  • 二 安装 Mysql 5.7
  • 三 安装Redis


前言

该系统和centos有一定的相似性,但是有一些小区别,所以在此记录项目所需依赖环境的搭建。


一 安装Python3.8

  • 安装依赖

    yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make libffi-devel  -y
    
  • 下载源码

    yum install wget -y
    wget https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tgz
    
  • 解压安装

    tar -zxvf Python-3.8.13.tgz
    cd Python-3.8.13
    # 安装位置为/usr/local/python3目录
    ./configure prefix=/usr/local/python3 --enable-optimizations
    sudo make && sudo make install
    
  • 添加软链接

    ln -s /usr/local/python3/bin/python3.8 /usr/bin/python38 
    ln -s /usr/local/python3/bin/pip3.8 /usr/bin/pip3
    
  • 使用Python3.8

    python38 app.py
    

二 安装 Mysql 5.7

  • 安装

    yum -y install wget
    # 安装mysql官方 Yum Repository
    wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
    yum -y install ./mysql57-community-release-el7-10.noarch.rpm
    # 以2022年为例
    sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
    yum -y install mysql-community-server
    # 启动
    systemctl start  mysqld.service
    systemctl status mysqld.service
    
  • 修改密码

    # 获取临时密码
    grep "password" /var/log/mysqld.log
    # 使用临时密码登录
    mysql -uroot -p
    # 修改密码( 包含大小写字母数字特殊字符不含单引号)
    mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Your_Password1';
    
  • 开启远程访问

    # 指定远程登录的ip为192.168.0.1,使用%代替具体ip则表示登录ip任意
    mysql> grant all privileges on *.* to 'root'@'192.168.0.1' identified by 'Remote_Password1' with grant option;
    mysql> flush privileges;
    
  • 开放3306端口

    firewall-cmd --zone=public --add-port=3306/tcp --permanent
    firewall-cmd --reload
    firewall-cmd --zone=public --list-ports
    
  • 字符设置

    vim /etc/my.cnf
    # 在文首添加下面两行:
    [client]
    default-character-set=utf8
    # 在socket=/var/lib/mysql/mysql.sock下面添加两行:
    character-set-server=utf8
    collation-server=utf8_general_ci
    # 重启mysql
    systemctl restart mysqld.service
    
  • windows访问

    mysql -h  ${host_ip}  -P  ${mysql_port}  -u root -p
    

三 安装Redis

  • 安装
    yum install epel-release
    yum install redis
    # 启动redis
    sudo systemctl start redis
    # 查看redis运行状态
    service redis status
    
  • 无法正常启动解决办法
    useradd redis -s /usr/sbin/nologin
    mkdir -p /var/log/redis
    chown -R redis:root /var/log/redis
    
    chown redis:root /etc/redis.conf
    
    mkdir -p /var/lib/redis
    chown -R redis:root /var/lib/redis
    

你可能感兴趣的:(linux,kylin,redis,mysql,centos)