杜郎俊赏

debian 10 开发环境部署

本地用Vagrant+VirtualBox创建、管理虚拟机,部署与阿里云ECS硬件和软件配置相近的开发环境(LNMP)。

安装vim

suapt-get install vimvim /etc/vim/vimrc#去掉 syntax on 前的注释,增加: set number set tabstop=4 set softtabstop=4 colorscheme desert#如果中文乱码,则增加: set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936 set termencoding=utf-8 set encoding=utf-8

安装sudo

apt-get install sudovim /etc/sudoers #增加: shagon ALL=(ALL:ALL) NOPASSWD:ALL

ssh配置

vim ~/.ssh/authorized_keys#禁止 root 远程密码登录sudo vim /etc/ssh/sshd_config#增加: PermitRootLogin no PasswordAuthentication no

定时校准时间

sudo apt-get install ntpdatecrontab -e#每天 2 点同步时间 0 2 * * * sudo ntpdate -u ntp.ubuntu.com

禁用 swap

sudo vim /etc/sysctl.conf#添加: vm.swappiness=0sudo vim /etc/fstab#将 swap 所在行注释掉

取消开机菜单

sudo vim /etc/default/grub#修改: GRUB_DEFAULT=0 GRUB_HIDDEN_TIMEOUT=0 GRUB_HIDDEN_TIMEOUT_QUIET=true GRUB_TIMEOUT=0sudo update-grub

安装oh-my-zsh

sudo apt-get install zsh gitsh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"sudo apt-get install autojump#皮肤配置放入 ~/.oh-my-zsh/themesvim ~/.zshrc#修改配置 ZSH_THEME="shagon" DISABLE_AUTO_UPDATE="true" plugins=(git autojump) alias l='ls -lahF --color=auto' alias ll='ls -lhF --color=auto' alias ls='ls -GF --color=auto'

安装nginx

sudo apt-get install nginxsudo vim nginx.conf#修改 http {} 中内容 client_max_body_size 1000m; server_tokens off; proxy_hide_header X-Powered-By; gzip_disable "msie6"; gzip_comp_level 9; gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png video/mp4; proxy_buffer_size 128k; proxy_buffers 32 32k; proxy_busy_buffers_size 128k;

另见:搭建https

安装redis

sudo apt-get install redis-server#配置纯内存运行sudo vim /etc/redis/redis.conf #save 900 1 #save 300 10 #save 60 10000 maxmemory 1GB maxmemory-policy volatile-lru appendfsync no#解决各种报警sudo vim /etc/sysctl.conf net.core.somaxconn=1024 vm.overcommit_memory = 1 vm.nr_hugepages=512 net.ipv4.icmp_echo_ignore_all=1sudo vim /etc/rc.local #!/bin/sh -e ulimit -n 65536 echo never > /sys/kernel/mm/transparent_hugepage/enabledsudo chmod +x /etc/rc.localsudo systemctl start rc-local.service

安装mysql

sudo apt-get install mariadb-server-10.3#设置账号MariaDB > set password for root@localhost = password('password');MariaDB > create user user@localhost identified by 'password';MariaDB > grant select, insert, update, delete, alter on *.* to user@localhost;#导出mysqldump --opt -uroot -p table > table.sql#导入mysql -uroot -p table < table.sql

安装php

sudo apt-get install php7.3 php7.3-fpm php7.3-devsudo vim /etc/php/7.3/fpm/php.ini#修改: error_reporting = E_ALL display_errors = On post_max_size = 2048M upload_max_filesize = 2048M pdo_mysql.cache_size = 2000 session.save_handler = redis session.save_path = tcp://127.0.0.1:6379sudo vim /etc/php/7.3/cli/php.ini#修改: short_open_tag = On error_reporting = E_ALL display_errors = On memory_limit = -1 [opcache] opcache.enable=1 opcache.enable_cli=1 opcache.memory_consumption=512 opcache.interned_strings_buffer=8 opcache.max_accelerated_files=10000 opcache.max_wasted_percentage=5 opcache.use_cwd=1 opcache.validate_timestamps=1 opcache.revalidate_freq=60 opcache.revalidate_path=0 opcache.save_comments=0 opcache.enable_file_override=0 opcache.file_cache=/tmp opcache.huge_code_pages=1

安装php 扩展

sudo apt-get install php-redis php7.3-mysql php7.3-mbstring php7.3-curl php7.3-gd php-imagick#安装 `yaf`sudo pecl install yafsudo vim /etc/php/7.3/mods-available/yaf.ini#写入 extension=yaf.so yaf.use_namespace=1 yaf.environ=develop yaf.cache_config=1 yaf.lowcase_path=1cd /etc/php/7.3/fpm/conf.dsudo ln -s ../../mods-available/yaf.ini 10-yaf.ini#安装分词系统sudo sucd /tmpwget http://www.xunsearch.com/scws/down/scws-1.2.3.tar.bz2tar xvjf scws-1.2.3.tar.bz2cd scws-1.2.3./configure --prefix=/usr/local/scws; make; make installcd /usr/local/scws/etcwget http://www.xunsearch.com/scws/down/scws-dict-chs-utf8.tar.bz2tar xvjf scws-dict-chs-utf8.tar.bz2cd /tmp/scws-1.2.3/phpextphpize./configure --with-scws=/usr/local/scws; make; make installvim /etc/php/7.3/mods-available/scws.ini#写入 extension = scws.so scws.default.charset = utf8 scws.default.fpath = /usr/local/scws/etccd /etc/php/7.3/fpm/conf.dln -s ../../mods-available/scws.ini 20-scws.ini

安装视频处理软件

sudo apt-get install ffmpeg

安装人脸识别

sudo apt-get install php-facedetect

安装glup(前端资源构建自动化)

sudo suapt-get install npmnpm install npm gulp -gcd /; mkdir gulp; cd gulpnpm install --save-dev gulp merge-stream gulp-csso gulp-uglify gulp-fontmin gulp-ttf2woff gulp-ttf2woff2 

标签:笔记
日期:2020-02-13