ubuntu 配置开发环境记录

2018-12-06  本文已影响0人  青晨点支烟

git安装

sudo apt install git

mysql安装和配置

sudo apt-get install mysql-server mysql-client

use mysql;
update user set authentication_string=PASSWORD("这里输入你要改的密码") where User='root'; #更改密码
update user set plugin="mysql_native_password"; #如果没这一行可能也会报一个错误,因此需要运行这一行
flush privileges; #更新所有操作权限
quit;

*关闭防火墙
systemctl unmask firewalld

nginx手动安装和配置

安装
sudo /usr/local/nginx/sbin/nginx    #启动
sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf #选定配置文件启动
sudo /usr/local/nginx/sbin/nginx -t #检测配置文件是否正确 
sudo /usr/local/nginx/sbin/nginx -s stop #停止服务
sudo /usr/local/nginx/sbin/nginx -s reload #重载配置文件
sudo /usr/local/nginx/sbin/nginx -s stop, quit, reopen, reload

运行启动命令报错如图
![)G51K0WXKZ(3N5P()EEZS6.png

解决:在nginx目录下新建logs目录
或者运行:/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

配置:
环境变量:
sudo vim ~/.bashrc
在最下面添加
export NGINX_HOME=/usr/local/nginx
export PATH=NGINX_HOME/sbin:PATH

配置https:
备份配置文件:mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak
修改https server:

# HTTPS server
    #
     server {

         listen  443 ssl;

         server_name     zhang-xin.club;

         ssl     on;


        ssl_certificate      /usr/local/nginx/cert/1_zhang-xin.club_bundle.crt;

        ssl_certificate_key  /usr/local/nginx/cert/2_zhang-xin.club.key;


        ssl_session_cache    shared:SSL:1m;

        ssl_session_timeout  5m;


        ssl_ciphers  HIGH:!aNULL:!MD5;

        ssl_prefer_server_ciphers  on;


        location / {

                proxy_pass  http://127.0.0.1:8000;

                root   html;

                index  index.html index.htm;

        }

        location /life {

                proxy_pass  http://127.0.0.1:8001;

                root   html;

                index  index.html index.htm;

        }

    }

goland 安装

下载:
cd /usr/local
sudo wget https://dl.google.com/go/go1.11.2.linux-amd64.tar.gz(需梯子)
解压:
sudo tar -zxvf go1.11.2.linux-amd64.tar.gz

配置环境变量:
vim ~/.bashrc
添加
export GOROOT=/usr/local/go
export GOPATH=/home/ubuntu/program_develop/gocode
export PATH=PATH:GOPATH:/usr/local/go/bin
保存并使生效
source ~/.bashrc
查看
go version
go env

上一篇下一篇

猜你喜欢

热点阅读