ubuntu

Ubuntu

  • 背景改成豆沙绿:
    • /usr/share/themes/Ambiance/gtk-3.0/gtk-main.css
      • bg_color、base_color -> #CCE8CF
  • iptables开启端口:
    ufw enable。ufw default deny。
    ufw allow proto tcp from any to any port ,,:

Nginx

  • 泛解析:
    server {
    listen 80;
    server_name ~^www.(?<subdomain>.+).hxingxing.com$;
    root /var/www/html/hxingxing/$subdomain/public;
    index index.html index.htm index.php;

    …… location ~ .php$ {
    try_files $uri =404;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param domain $subdomain;
    include fastcgi_params;
    }
    ……
    }

Mysql

  • 备份mysql远程数据库并清除一个月之前的数据:
    • hxingxing-backup.sh:
      date="$(date +"%Y-%m-%d")"
      mysqldump -u root -h localhost -p'' hxingxing | gzip - > "/root/db-backup/hxingxing-$date.gz"
    • cron
        * * * root /root/db-backup/hxingxing-backup.sh
  • mysql允许远程:
    • root使用密码123456,从任何主机连接:
      mysql>GRANTALLPRIVILEGESON*.* TO'root'@'%'IDENTIFIED BY'123456'WITH GRANTOPTION

      允许jack使用密码654321,从ip 10.10.50.127的主机连接

      mysql>GRANTALLPRIVILEGESON*.* TO'jack'@’10.10.50.127’ IDENTIFIED BY''WITH GRANTOPTION;
      mysql>FLUSH RIVILEGES
  • Mariadb更新root密码:
    update user set plugin='' where User='root';
    flush privileges;

PHP

  • phpize:
    apt install php7.-dev
  • 安装phalcon:
    curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh | sudo bash
    sudo apt-get install php7.-phalcon

VCS

  • Git修改文件权限不影响文件git状态。132 3273 juli 5289
    git config core.fileMode false
  • SVN
    • 安装rabbitvcs:
      apt install rabbitvcs-cli rabbitvcs-core rabbitvcs-gedit rabbitvcs-nautilus 
    • /etc/subversion/config
      [tunnels]
      = ssh -p {port} -l {username}
    • ssh证书登录
      • svn客户端执行
        ssh-keygen -t rsa
        scp -P /root/.ssh/id_rsa.pub <svn帐号>@dibon.cetlab.org:/home/<svn帐号>
        cp /root/.ssh/id_rsa.pub /home/<本地用户>/.ssh/id_rsa.pub
        chmod -R /home/<本地用户>/.ssh
      • svn服务端执行(ssh <svn帐号>@dibon.cetlab.org -p 13022)
        cat id_rsa.pub >> /home/<svn帐号>/.ssh/authorized_keys
        chmod .ssh/authorized_keys

Package tool

  • Ubuntu下node库和nodejs冲突:
    sudo ln -s /usr/bin/nodejs /usr/bin/node
  • pip淘宝源:
    • vim ~/.pip/pip.conf
      [global]
      trusted-host = mirrors.aliyun.com
      index-url = http://mirrors.aliyun.com/pypi/simple/

DB tool

  • mongoChef:http://3t.io/mongochef/download/core/platform/#tab-id-3
上一篇:Android 自定义线程池的实战


下一篇:使用Markup解析xml文件