mysql

mysql,第1张

mysql

文章目录
        • ubuntu root修改密码
        • ubuntu python安装
          • 1.安装依赖
          • 2. 下载解压安装包
          • 3.编译Python源:
          • 4. 建立python3.6的软链接
          • 5.将/etc/python3.6/bin加入PATH:
          • 6.激活配置
          • 7.查看Python的版本
          • 8.安装虚拟环境virtualenv
          • 9.ERROR: virtualenvwrapper could not find virtualenv in your path
          • 10.创建Python的虚拟环境
        • mysql安装
          • 1. 更新源
          • 2. 安装MySql服务器和客户端
          • 3. 修改密码
          • 4. 重置用户和密码
          • 5.quit退出mysql交互模式,去掉之前加的skip-grant-tables,再重启mysql
        • git安装及卸载
          • 0.检查是否有 git
          • 1. 卸载git
          • 2.安装
          • 3.配置git 全局环境
          • 4.生成ssh密钥
          • 5. 测试连接
          • 6.git使用命令
        • redis 安装
        • nginx 安装及卸载
          • 1. 安装nginx
          • 2. nginx卸载
          • 3.Nginx 配置
        • gunicorn安装
          • 1.下载
          • 2.运行

ubuntu root修改密码
sudo passwd root
ubuntu python安装

参考链接

1.安装依赖
sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
2. 下载解压安装包
mkdir -p /etc/python3.6
cd /etc/python3.6
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
sudo tar xzf Python-3.6.4.tgz
3.编译Python源:
cd Python-3.6.4
sudo ./configure --enable-optimizations --prefix=/etc/python3.6
sudo make altinstall
4. 建立python3.6的软链接
ln -s /etc/python3.6/bin/python3.6 /usr/bin/python3.6
ln -s /etc/python3.6/bin/pip3.6 /usr/bin/pip3.6
5.将/etc/python3.6/bin加入PATH:
vim ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin:/etc/python3.6/bin
export PATH
6.激活配置
source ~/.bash_profile
7.查看Python的版本
pyhton3.6 
pip3 -V 
如果系统提示没有安装pip3
sudo apt install python3-pip
8.安装虚拟环境virtualenv
sudo apt install python3-virtualenv
pip3 install virtualenvwrapper
# 接着配置virtualwrapper的环境变量,采用vim来打开~/.bashrc
vim ~/.bashrc 拉到文件底部

export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
# 虚拟环境存储的目录
export WORKON_HOME=$HOME/.virtualenvs
source /home/ubuntu/.local/bin/virtualenvwrapper.sh  # 此处是你的安装位置

source ~/.bashrc
9.ERROR: virtualenvwrapper could not find virtualenv in your path
使用pip3安装virtualenv和virtualenvwrapper两个包,ubuntu18.04中,用户使用pip安装的包在~/.local/下,在.bashrc中添加的配置如下:
# Python Virtualenv Settings
export WORKON_HOME=~/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source ~/.local/bin/virtualenvwrapper.sh

使用mkvirtualenv创建虚拟环境时,报错如下:
roc@roc-ThinkPad-E455:~$ mkvirtualenv remote
ERROR: virtualenvwrapper could not find virtualenv in your path

    
提示virtualenv 不在环境中,需要在配置文件添加virtualenv的路径进去,具体配置如下
# Python Virtualenv Settings
export WORKON_HOME=~/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
# 指定virtualenv的路径
export VIRTUALENVWRAPPER_VIRTUALENV=~/.local/bin/virtualenv
source ~/.local/bin/virtualenvwrapper.sh

然后重新加载.bashrc文件即可
10.创建Python的虚拟环境
mkvirtualenv -p python3.6 虚拟环境名称
mkvirtualenv -p python3.6 env 
source env/bin/activate 进入虚拟环境
deactivate 退出虚拟环境
mysql安装 1. 更新源
sudo apt update
2. 安装MySql服务器和客户端
 sudo apt install mysql-server mysql-client
3. 修改密码
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
service mysql restart
在[mysqld]中添加skip-grant-tables
mysql -u root -p  直接回车
sudo cat /etc/mysql/debian.cnf  mysql -u*** -p***
4. 重置用户和密码
use mysql; 
update mysql.user set authentication_string=password('123456') where user='root' and Host ='localhost';  
update user set  plugin="mysql_native_password"; 
flush privileges;
5.quit退出mysql交互模式,去掉之前加的skip-grant-tables,再重启mysql git安装及卸载 0.检查是否有 git
git version
1. 卸载git
sudo apt-get remove git
2.安装
1. sudo apt-get update
2. sudo apt-get install git
3.配置git 全局环境
1. git config --global user.name "用户名"
2. git config --global user.email "邮箱地址"
4.生成ssh密钥
ssh-keygen -C 'you email [email protected]' -t rsa

会在用户目录~/.ssh/下建立相应的密钥文件

使用命令cd /.ssh进入/.ssh文件夹,输入
cat id_rsa.pub
打开id_rsa.pub文件,复制其中所有内容。接着访问git网页,点击SSH公钥,标题栏可以随意输入,公钥栏把 刚才复制的内容粘贴进去

5. 测试连接
ssh -T [email protected]
6.git使用命令
git clone 项目地址  拉项目
git pull    拉代码
git push  提交到仓库
git init指令初始化一个git仓库
git add .添加文件
git commit -m "注释"提交至仓库。
git remote add origin https://git.oschina.net/你的用户名/项目名.
git,git push origin master即可完成推送
git checkout master   切换到master分支
redis 安装
sudo apt-get install redis-server
ps -aux|grep redis 命令可以看到服务器系统进程默认端口6379
sudo /etc/init.d/redis-server status  可以看到Redis服务器状态
配置文件为/etc/redis/redis.conf

Redis服务器默认是不需要密码的,假设设置密码为hzlarm。
去掉requirepass 前面的注释#,在后面添加密码
requirepass hzlarm  修改密码

开启Redis的远程连接
注释掉绑定地址#bind 127.0.0.1

推荐改为yes,以守护进程运行
daemonize no|yes

配置完成后重新启动服务器
sudo /etc/init.d/redis-server restart or
sudo service redis-server restart or
sudo redis-server /etc/redis/redis.conf


nginx 安装及卸载 1. 安装nginx
sudo apt-get install nginx
2. nginx卸载
sudo apt-get remove nginx nginx-common # 卸载删除除了配置文件以外的所有文件。
sudo apt-get purge nginx nginx-common # 卸载所有东东,包括删除配置文件。
sudo apt-get autoremove # 在上面命令结束后执行,主要是卸载删除Nginx的不再被使用的依赖包。
sudo apt-get remove nginx-full nginx-common #卸载删除两个主要的包。 
sudo service nginx restart  #重启nginx
3.Nginx 配置

默认安装到/usr/local/nginx/目录,进入目录

启动nginx

#启动
sudo /usr/local/nginx/sbin/nginx
# 重新启动
sudo /usr/local/nginx/sbin/nginx -s reload
# 指定配置文件重启
 /etc/nginx$ sudo /usr/sbin/nginx -s reload -c /etc/nginx/nginx.conf
# 运行下面命令查看修改
nginx -t
# 停止
sudo sbin/nginx -s stop
# 查看端口占用情况 
netstat -ap|grep 8022
# 检查nginx是否已经启动
ps -aux | grep nginx
# 关闭指定端口
kill -9 PID号 
# 杀死nginx程序
pkill -9 nginx
# 查看主配置文件
/usr/sbin/nginx -t 
# 可用查找配置文件路径s
cat /etc/nginx/nginx.conf  

配置nginx 打开/usr/local/nginx/conf/nginx.conf文件

proxy_set_header 和proxy_set_header 代表被nginx代理的用户的真实ip port

location 类似于falsk中url列表

gunicorn安装 1.下载
pip install gunicorn
gunicorn -h查看支持哪些配置参数
2.运行
gunicorn -w 开启进程数 
		 -b 指明绑定到哪个ip:port 
         --access-logfile  ./logs/log 把用户请求信息放到日志文件
         manage:app  运行哪个app
         -D 以守护进程的方式去运行
ps aux | grep gunicorn
kill -9 进程号  来结束gunicorn进程
pipenv run gunicorn blogproject.wsgi -w 2 -k gthread -b 127.0.0.1:8000 -D  # django运行
gunicorn -w 4 -b 0.0.0.0:8022 -k gthread manage:app -D  --access-logfile ./logs/log2

ess-logfile ./logs/log 把用户请求信息放到日志文件
manage:app 运行哪个app
-D 以守护进程的方式去运行
ps aux | grep gunicorn
kill -9 进程号 来结束gunicorn进程
pipenv run gunicorn blogproject.wsgi -w 2 -k gthread -b 127.0.0.1:8000 -D # django运行
gunicorn -w 4 -b 0.0.0.0:8022 -k gthread manage:app -D --access-logfile ./logs/log2

					
										


					

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5659719.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存