linux debain服务器配置

debian 软件包 https://packages.debian.org/stable/

whereis apache2
dpkg -L apache2 查看安装的包在哪里

apt-get install locales
dpkg-reconfigure locales
#勾选“en_US.UTF-8”和“zh_CN.UTF-8”
apt-get update#安装时提示404则更新下
apt-get dist-upgrade
apt-get install apache2
apt-get install mysql-server
apt-get install php7.2-fpm
apt-get install php7.2-mbstring
apt-get install php7.2-dom
apt-get install php7.2-curl
apt-get install php7.2-gd
apt-get install php7.2-mysql
service php7.2-fpm restart
apt-get install git
apt-get install node
apt-get install npm
npm install -g pm2
apt-get install redis-server
#composer
php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
mv composer.phar /usr/local/bin/composer
#apache配置
vi /etc/apache2/apache2.conf
# AllowOverride all
a2enmod rewrite#开启重写模块,取消模块a2dismod
#gzip
a2enmod deflate#压缩模块
a2enmod headers
vi /etc/apache2/mods-available/deflate.conf
#添加
        SetOutputFilter DEFLATE
        SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
        SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
        SetEnvIfNoCase Request_URI .(?:pdf|mov|avi|mp3|mp4|rm)$ no-gzip dont-vary
        AddOutputFilterByType DEFLATE text/*
        AddOutputFilterByType DEFLATE application/ms* application/vnd* application/postscript application/javascript application/x-javascript
        AddOutputFilterByType DEFLATE application/x-httpd-php application/x-httpd-fastphp
        BrowserMatch ^Mozilla/4 gzip-only-text/html
        BrowserMatch ^Mozilla/4.0[678] no-gzip
        BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
a2enmod deflate
#apache站点
cd /etc/apache2/sites-available
cp -f 000-default.conf xuanzeta.com.conf
vi xuanzeta.com.conf
#重写
#RewriteEngine on 
        #RewriteCond   %{HTTPS} !=on 
        #RewriteRule   ^(.*)  https://%{SERVER_NAME}$1 [L,R] 
#servername
ServerName xuanzeta.com
DocumentRoot /var/www/web
#代理
#DocumentRoot /var/www/zhshht/public
        ProxyPreserveHost On 
        ProxyPass / http://localhost:6001/ 
        ProxyPassReverse / http://localhost:6001/ 

:wq
a2ensite xuanzeta.com.conf#启动站点,取消站点a2dissite
service apache2 reload
service apache2 restart
#远程mysql
#netstat -an|grep 3306 端口未开放
vi /etc/mysql/my.cnf
#bind-address = 127.0.0.1
service mysql restart
mysql -u root -p

 

mac VIM

https://github.com/mxyg/f-vim

sudo xcodebuild -license

brew install lua

https://github.com/mxyg/vim-plug

:PlugInstall



apache mac 配置+多站点

/etc/apache2/httpd.conf

去掉注释
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php5_module libexec/apache2/libphp5.so
Include /private/etc/apache2/extra/httpd-vhosts.conf
User _www 改 User liuman

/private/etc/apache2/extra/httpd-vhosts.conf文件添加多网站

Listen 8001
<VirtualHost *:8001>
    DocumentRoot "/Users/liuman/phpinfo"
	<Directory "/Users/liuman/phpinfo">
    Options FollowSymLinks Multiviews
    MultiviewsMatch Any
    AllowOverride All
    Require all granted
	</Directory>
</VirtualHost>

Listen 8002
<VirtualHost *:8002>
    DocumentRoot "/Users/liuman/jlcloud2"
	<Directory "/Users/liuman/jlcloud2">
    Options FollowSymLinks Multiviews
    MultiviewsMatch Any
    AllowOverride All
    Require all granted
	</Directory>
</VirtualHost>

Listen 8003
<VirtualHost *:8003>
    DocumentRoot "/Users/liuman/web"
	<Directory "/Users/liuman/web">
    Options FollowSymLinks Multiviews
    MultiviewsMatch Any
    AllowOverride All
    Require all granted
	</Directory>
</VirtualHost>

Listen 8004
<VirtualHost *:8004>
    DocumentRoot "/Users/liuman/backend-jquery"
	<Directory "/Users/liuman/backend-jquery">
    Options FollowSymLinks Multiviews
    MultiviewsMatch Any
    AllowOverride All
    Require all granted
	</Directory>
</VirtualHost>

Listen 8005
<VirtualHost *:8005>
    DocumentRoot "/Users/liuman/laravel5"
	<Directory "/Users/liuman/laravel5">
    Options FollowSymLinks Multiviews
    MultiviewsMatch Any
    AllowOverride All
    Require all granted
	</Directory>
</VirtualHost>
Listen 8007
<VirtualHost *:8007>
    DocumentRoot "/Users/liuman/wordpress"
 <Directory "/Users/liuman/wordpress">
    Options FollowSymLinks Multiviews
    MultiviewsMatch Any
    AllowOverride All
    Require all granted
 </Directory>
</VirtualHost>

mac基础

Mac基本快捷键

space:预览

command+w:关闭

command+q:退出

command+z:撤销

command+shift+z:重做

command+x:剪切

command+c:复制

command+v:粘贴

command+a:全选

command+r:刷新

command+s:保存

command+f:查找

command+space:切换输入法

command+tab:程序切换

command+~:同程序窗口切换

command++:放大

command+—:缩小

command+h:隐藏当前窗口

command+alt+f:隐藏除当前窗口外其他窗口

command+delete:删除

command+shift+delete:清空废纸篓

fn+command+delete:删除后面

command+方向键:光标跳到文本行的首位和文件的首位

command+F3:显示桌面

command+n:打开新窗口

command+m:最小化窗口

command+o:打开文件

command+ctrl+f:全屏

command+shift+3:截取全屏(+alt保存到剪切版)

command+shift+4:截取部分屏幕(按住space空格键选取窗口+alt保存到剪切版)

command+alt+esc:强制退出程序

按住command可以多选文件

开机alt选择启动驱动

control+shift+电源:关闭显示器

command+alt+电源:睡眠

command+control+电源:重启

sudo open . 打开当前文件夹

触控板快捷方式-系统偏好设置-触控板有演示(滚动方向-自然不勾选)

mac更新ruby

curl -L get.rvm.io | bash -s stable
source ~/.bashrc  
source ~/.bash_profile
#查看当前ruby版本  
ruby -v  
ruby 1.8.7  
#列出已知的ruby版本  
rvm list known  
#安装ruby 2.3.0
rvm install 2.3.0
#Error running 'requirements_osx_brew_update_system ruby-2.3.0',showing last 15 lines of /Users/liuman/.rvm/log/1471250320_ruby-2.3.0/update_system.log
rvm autolibs read-only # read more here:https://rvm.io/rvm/autolibs
rvm install ruby

mac自动启动服务

homebrew.mxcl.authenmng.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>homebrew.mxcl.authenmng</string>
	<key>ProgramArguments</key>
    <array>
      <string>/Library/StartupItems/iNodeAuthService/iNodeAuthService</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
  </dict>
</plist>
sudo chown root:wheel /Library/LaunchDaemons/homebrew.mxcl.authenmng.plist

mac配置

初始不设置磁盘加密
显示隐藏文件

defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder

不显示隐藏文件

defaults write com.apple.finder AppleShowAllFiles -boolean false ; killall Finder

Mac基本快捷键

space:预览
command+w:关闭
command+q:退出
command+z:撤销
command+shift+z:重做
command+x:剪切
command+c:复制
command+v:粘贴
command+a:全选
command+r:刷新
command+s:保存
command+f:查找
command+space:切换输入法
command+tab:程序切换
command+~:同程序窗口切换
command++:放大
command+—:缩小
command+h:隐藏当前窗口
command+alt+f:隐藏除当前窗口外其他窗口
command+delete:删除
command+shift+delete:清空废纸篓
fn+command+delete:删除后面
command+方向键:光标跳到文本行的首位和文件的首位
command+F3:显示桌面
command+n:打开新窗口
command+m:最小化窗口
command+o:打开文件
command+ctrl+f:全屏
command+shift+3:截取全屏(+alt保存到剪切版)
command+shift+4:截取部分屏幕(按住space空格键选取窗口+alt保存到剪切版)
command+alt+esc:强制退出程序
按住command可以多选文件
开机alt选择启动驱动
control+shift+电源:关闭显示器
command+alt+电源:睡眠
command+control+电源:重启

触控板快捷方式-系统偏好设置-触控板有演示(滚动方向-自然不勾选)

环境变量设置:终端输入export PATH=/usr/local/php/bin:$PATH 或者在/etc/profile文件最后加入,立即执行环境变量文件source /etc/profile

安装brew

git config --global http.postBuffer 524288000
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

终端:终端iterm2下载 Finder-自定义工具栏-iterm2拖到工具栏上

Git:gitkarken下载

编辑器:macvim下载 macvim放到应用程序下 mvim放到/usr/bin/下

vim中文帮助:vimdoc下载 根目录sudo ./vimcdoc.sh -i

更多vim配置

ftp:filezilla客户端下载

数据库:mysql下载 安装后系统偏好设置有个Mysql图标,可以启动Mysql服务。

mysql配置:/usr/local/mysql/为maysql目录
设置mysql不需要密码,经常出错没有root密码,干脆不要密码,等创建完用户记得删掉,个人电脑就无所谓了,要密码还麻烦。

sudo cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
sudo vi /etc/my.cnf
#[mysqld]下添加
skip-grant-tables
#esc :wq!

apache:mac自带了apache,不需要安装,看了下版本是2.4.16,官方是2.4.20,还可以。apache服务的目录/etc/httpdctl或者/usr/sbin/httpd,模块目录/usr/libexec/apache2/,配置文件目录/etc/apache2/。启动服务:sudo apachectl start

安装php:php下载

#扩展openssl gd mbstring
./configure --prefix=/usr/local/php --with-apxs2=/usr/sbin/apxs --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd
make
make install
sudo cp php.ini-development /usr/local/php/lib/php.ini

配置apache

sudo vi /etc/apache2/httpd.conf
#查找字符串AddType,并增加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#查找字符串
DirectoryIndex
#并修改为
DirectoryIndex index.html index.php default.php
#将#LoadModule rewrite_module libexec/apache2/mod_rewrite.so的#删除
#AllowOverride None 改 AllowOverride All

php扩展安装

phpize

m4下载 autoconf下载
先编译安装m4然后编译安装autoconf

./configure
make
make install

或者使用brew

brew install homebrew/dupes/m4
brew install autoconf

扩展openssl

#进入到目录etc/openssl
export PATH=/usr/local/php/bin/:$PATH
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install

php.ini加extension =openssl.so
重启apache
mongodb安装

#mongodb安装
brew install mongodb --with-openssl
#mongodb设置开机启动
ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
#mongod服务启动
mongod --config /usr/local/etc/mongod.conf

node安装:

brew install node

redis安装

#redis安装
brew install redis
#redis设置开机启动
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
#redis服务启动
redis-server /usr/local/etc/redis.conf

supervisor安装

npm install supervisor -g

php不识别imagecreate()

没有gd,编译php扩展gd。
php.ini添加extension = gd.so

如果提示没有png.h则安装libpng:brew install libpng

php不识别imagettftext

安装freetype再重新编译gd:freetype下载

./configure --prefix=/usr/local/freetype
make
sudo make install
#编译freetype过程中以下harfbuss没有则安装
#  external zlib: yes (pkg-config)
#  bzip2:         yes (autoconf test)
#  libpng:        yes (pkg-config)
#  harfbuzz:      no  (pkg-config)
brew install harfbuzz

进入到php/ext/gd/

make clean
#重新编译GD之前一定要make clean就是因为忘记了这个找个半天错误。
phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-freetype-dir=/usr/local/freetype
make
sudo make install

php不识别imagecreatefromjpeg

安装jpegsrc再重新编译gd:jpegsrc下载

./configure --prefix=/usr/local/jpeg
make
sudo make install

进入到php/ext/gd/

make clean
phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype
make
sudo make install

linux下安装FileZilla

filezilla客户端安装

filezilla客户端下载

将文件夹放到/usr/local/下,或者其他位置也可。

默认启动在 FileZilla3/bin/filezilla

快捷方式创建:

在桌面创建一个文档,更名filezilla.desktop

内容

[Desktop Entry]
Name = FileZilla
Type = Application
Exec = /usr/local/FileZilla3/bin/filezilla

保存之后右键文件-属性-权限-允许作为程序执行文件

ubuntu系统filezilla桌面快捷方式

linux学习三(ubuntu系统)

ubuntu下使用root登陆

设置root

sudo passwd root

输入设置密码

vi /etc/lightdm/lightdm.conf
[SeatDefaults]
greeter-session=unity-greeter
user-session=ubuntu
greeter-show-manual-login=true #手工输入登陆系统的用户名和密码
allow-guest=false #不允许guest登录

用root权限打开窗口

sudo nautilus

创建桌面快捷方式

以woekbench为例,默认启动命令mysql-workbench

在桌面创建一个文档,更名workbench.desktop

内容

[Desktop Entry]
Name = Workbench
Type = Application
Exec = mysql-workbench

保存之后右键文件-属性-权限-允许作为程序执行文件

ubuntu系统workbench桌面快捷方式