ubuntu 配置开发环境记录

git安装

sudo apt install git

mysql安装和配置

sudo apt-get install mysql-server mysql-client

  • 查看是否安装成功
    sudo netstat -tap | grep mysql

  • 登录
    mysql -uroot -p123456

  • 退出
    exit

  • 设置mysql远程访问
    sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
    注释掉这一行


    IWE)[1~4ED]1B1M4SKK69V2.png
  • 修改密码
use mysql;
update user set authentication_string=PASSWORD("这里输入你要改的密码") where User='root'; #更改密码
update user set plugin="mysql_native_password"; #如果没这一行可能也会报一个错误,因此需要运行这一行
flush privileges; #更新所有操作权限
quit;
  • 重启
    sudo /etc/init.d/mysql restart

*关闭防火墙
systemctl unmask firewalld

nginx手动安装和配置

安装
  • 下载网址:http://nginx.org/en/download.html
    进入安装目录:cd /usr/local
  • 下载nginx: sudo wget http://nginx.org/download/nginx-1.14.2.tar.gz
  • 解压:sudo tar -zxvf nginx-1.14.2.tar.gz
  • 删除压缩包:sudo rm nginx-1.14.2.tar.gz
  • 重命名文件夹为nginx:sudo mv nginx-1.14.2/ nginx/
  • 安装库:sudo apt install libpcre3 libpcre3-dev libssl-dev
  • 编译:sudo ./configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_stub_status_module --with-http_ssl_module
  • 编译安装:sudo make
    启动、停止、重载配置、测试配置文件
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=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=GOPATH:/usr/local/go/bin
保存并使生效
source ~/.bashrc
查看
go version
go env

你可能感兴趣的:(ubuntu 配置开发环境记录)