liujia 发布的文章

在 Ubuntu 16.04 里安装 SQL Server 2017

环境:2GB内存,Ubuntu 16.04 64位

过程:

  1. apt-get update # 更新软件仓库
  2. apt install software-properties-common # 安装软件安装源工具
  3. curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - # 添加安装源GPG keys
  4. add-apt-repository "$(curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list)" # 添加 mssql-server 安装源
  5. apt-get update # 更新软件仓库
  6. apt-get install -y mssql-server # 安装 sql server 2017
  7. /opt/mssql/bin/mssql-conf setup # 初始化设置,如选择SQL Server版本和设置SA账户密码
  8. curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - # 添加安装源GPG keys
  9. add-apt-repository "$(curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list)" # 添加 sqlcmd 安装源
  10. apt-get update # 更新软件仓库
  11. apt-get install -y mssql-tools unixodbc-dev # 安装 sqlcmd 及相关软件
  12. 在Shell中添加 sqlcmd 的路径,方便使用:

    echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
    echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
    source ~/.bashrc
  13. sqlcmd -S localhost -U SA -P hePING573 # 连接本地sql server
  14. CREATE DATABASE AliYun # 创建 AliYun 数据库
  15. SELECT Name from sys.Databases # 列出数据库名称
  16. GO # 执行上边两条sql语句
  17. QUIT # 退出当前sql连接
  18. 在本地,使用第三方管理软件HeidiSQL远程连接,成功

参考:https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-ubuntu

在 CentOS 7 里安装 tomcat 7 openjdk 1.8 nginx mysql 5.6

yum update
yum install java-1.8.0-openjdk
yum install tomcat
yum install nginx

            proxy_pass         http://127.0.0.1:8080; 
            proxy_redirect     off;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

yum install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server

echo 0 >/proc/sys/net/ipv6/conf/all/disable_ipv6
echo 0 >/proc/sys/net/ipv6/conf/default/disable_ipv6

ifconfig sit0 up
ifconfig sit0 inet6 tunnel ::66.220.18.42
ifconfig sit1 up
ifconfig sit1 inet6 add ::2/64
route -A inet6 add ::/0 dev sit1

nohup ping6 ipv6.google.com >/dev/null 2>&1 &

在 Ubuntu 16.04 里安装 FastDFS 5.11 - 单台服务器

环境:Ubuntu 16.04 64位,FastDFS 5.11,nginx 1.12,本例服务器IP:172.16.252.32

过程:

  1. apt-get update # 更新软件仓库
  2. apt-get install git # 安装 git 工具,等会复制 libfastcommon
  3. git clone https://github.com/happyfish100/libfastcommon.git # 复制 libfastcommon 源码到本地
  4. ./make.sh # 解压,并进入到 libfastcommon 的目录里,编译
  5. ./make.sh install # 安装
  6. ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so # 创建符号链接
  7. wget https://github.com/happyfish100/fastdfs/archive/V5.11.tar.gz # 下载 fastdfs 5.11版本
  8. ./make.sh # 解压,并进入到 fastdfs 的目录里,编译
  9. ./make.sh install # 安装
  10. cp /etc/fdts/client.conf.sample /etc/fdts/client.conf # 创建 client.conf 配置文件,同理,创建好 storage.conf 和 tracker.conf
  11. adduser fastdts # 创建普通用户 fastdts ,上传的文件将主要存储在这 /home/fastdts
  12. 修改 tracker.conf 配置文件里的 base_path 参数,如本例 base_path=/home/fastdfs
  13. 修改 storage.conf 配置文件里的base_path, store_path0, tracker_server 参数,如本例 base_path=/home/fastdfs , store_path0=/home/fastdfs , tracker_server=172.16.252.32:22122
  14. 修改 client.conf 配置文件里的 base_path 和 tracker_server 参数,如本例 base_path=/home/fastdfs , tracker_server=172.16.252.32:22122
  15. 在FastDFS软件包里conf目录里的 http.conf mime.types 复制到 /etc/fdts/ ,且在 client.conf 配置文件里引用 http.conf 的文件(将“##include http.conf”修改成“#include http.conf”)
  16. /etc/init.d/fdfs_trackerd start # 启动 trackerd 进程
  17. /etc/init.d/fdfs_storaged start # 启动 storaged 进程
  18. fdfs_test /etc/fdfs/client.conf upload /root/ali_10.png # 在服务器本地上传图片测试,得到远程文件名:M00/00/00/rBD8IFoeip-AXBnkAAJuOBgfXyE450.png
  19. wget http://nginx.org/download/nginx-1.12.2.tar.gz # 下载 nginx 源码包
  20. apt-get install libpcre3 libpcre3-dev zlib1g-dev openssl libssl-dev # 准备好编译环境
  21. git clone https://github.com/happyfish100/fastdfs-nginx-module # 复制 fastdfs-nginx-module 的源码文件,假如保存在 /usr/local/fastdfs-nginx-module
  22. ./configure --prefix=/usr/local/nginx --add-module=/usr/local/fastdfs-nginx-module/src/ # 解压后,到nginx的目录中的配置
  23. make # 编译
  24. make install # 安装 nginx
  25. vi /usr/local/nginx/conf/nginx.conf # 修改 nginx 的站点配置内容,如下:

    location /M00 {
    root /home/fastdfs/data;
    ngx_fastdfs_module;
    }
  26. ln -s /home/fastdfs/data /home/fastdfs/data/M00 # 创建 M00 的符号链接
  27. cp /usr/local/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdts # 复制 mod_fastdfs.conf 配置文件
  28. vi /etc/fdts/mod_fastdfs.conf 配置文件里的 tracker_server 和 store_path0 值,如本例 tracker_server=172.16.252.32:22122, store_path0=/home/fastdfs
  29. /usr/local/nginx/sbin/nginx # 启动 nginx
  30. 在浏览器里访问测试,可以显示上传的文件内容,如 http://swas.anqun.org/M00/00/00/rBD8IFoeip-AXBnkAAJuOBgfXyE450.png

参考:

在 Debian 8 系统里安装 jupyter notebook

环境:Debian 8

过程:

  1. Debian 8 默认的 python 版本是2.7,按 jupyter notebook 的安装建议,先安装 python3.6:

    wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz
    tar xzvf Python-3.6.3.tgz
    cd Python-3.6.3
    ./configure
    make
    make install
  2. 新建一个普通用户,如liujia,登录后将python3.6加到bash配置文件中:
    echo 'alias python="/usr/local/bin/python3.6"' >> ~/.bashrc
  3. 下载 Anaconda3,安装:
    wget https://repo.continuum.io/archive/Anaconda3-5.0.1-Linux-x86_64.sh
    bash ./Anaconda3-5.0.1-Linux-x86_64.sh
  4. 安装好后,将 Anaconda3 路径加到 bash 配置文件中:
    export PATH=/home/liujia/anaconda3/bin:$PATH
    source ~/.bashrc
  5. 运行 jupyter notebook
    jupyter notebook --no-browser --ip=0.0.0.0
  6. 默认 jupyter notebook 使用 8888 端口,如需通过 80 端口访问,可安装 nginx 后使用 proxy_pass 代理访问

参考: