分类 阿里云 下的文章

在 FreeBSD 11 里安装使用 apache24 + php7.1(php-fpm) + mysql 5.7

环境:FreeBSD 11.1-RELEASE

过程:

  1. pkg install apache24 # 安装 apache2.4
  2. pkg install mysql57-server # 安装 mysql server 5.7
  3. pkg install php71 php71-curl php71-gd php71-mbstring php71-mcrypt php71-mysqli php71-openssl php71-pdo_mysql php71-xml # 安装 php7.1 和相关模块
  4. /usr/local/etc/apache24/httpd.conf # 编辑 httpd 的配置文件,本例,启用了好些模块 rewrite_module, mpm_event_module, http2_module, ssl_module, mod_proxy_fcgi, mod_proxy,引用了 httpd-vhosts.conf 文件,禁用了 mpm_worker_module 模块
  5. /usr/local/etc/apache24/extra/httpd-vhosts.conf # 编辑虚拟主机配置文件,如下例,是添加了https站点 portal.anqun.org的配置内容

    Listen 443
    <VirtualHost *:443>
        Protocols h2 http/1.1
        ServerName portal.anqun.org
    
        SSLEngine on
        SSLCertificateFile "/usr/local/etc/apache24/ssl/214238936730268.pem"
        SSLCertificateKeyFile "/usr/local/etc/apache24/ssl/214238936730268.key"
    
        DocumentRoot "/usr/local/www/portal_anqun_org/public_html"
        ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/www/portal_anqun_org/public_html/$1
        ErrorLog "/usr/local/www/portal_anqun_org/logs/error.log"
    
    <Directory "/usr/local/www/portal_anqun_org/public_html">
        AllowOverride All
        DirectoryIndex index.php index.html
        Require all granted
        Allow from all
    </Directory>
    
    </VirtualHost>
  6. sysrc apache24_enable=yes # 允许 apache24 服务
  7. sysrc mysql_enable=yes # 允许 mysql-server 服务
  8. sysrc php_fpm_enable=yes # 允许 php-fpm 服务
  9. service apache24 start # 启动 apache24 服务
  10. service mysql-server start # 启动 mysql-server 服务
  11. service php-fpm start # 启动 php-fpm 服务
  12. ALTER USER 'root'@'localhost' IDENTIFIED BY 'niDEpASSWORD' ; # 首次启动mysql5.7后,root的密码会写在/root/.mysql_secret 文件里,需要用 ALTER USER 命令更改密码后使用
  13. 安装wordpress,测试正常

参考:

在 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 代理访问

参考: