安装依赖库和编译工具 1 yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker package -y
下载解压编译git 1 2 3 4 5 6 cd /usr/local/srcwget https://www.kernel.org/pub/software/scm/git/git-2.16.2.tar.gz tar -zvxf git-2.16.2.tar.gz cd git-2.16.2make all prefix=/usr/local/git make install prefix=/usr/local/git
配置git环境变量 1 2 echo 'export PATH=$PATH:/usr/local/git/bin' >> /etc/bashrcsource /etc/bashrc
创建git仓库 1 2 3 4 5 mkdir /home/git/chown -R $USER :$USER /home/git/chmod -R 755 /home/git/cd /home/git/git init --bare hexoBlog.git
创建git hook 1 2 3 4 5 6 cat <<EOF > /home/git/hexoBlog.git/hooks/post-receive #!/bin/bash git --work-tree=/home/hexoBlog --git-dir=/home/git/hexoBlog.git checkout -f EOF chmod +x /home/git/hexoBlog.git/hooks/post-receive
安装nginx nodejs npm 1 yum install -y nginx nodejs npm
配置github账户 1 2 git config --global user.email "" git config --global user.name ""
nginx配置 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 server { listen 443 ssl; server_name cloud.tencent.com; ssl_certificate cloud.tencent.com_bundle.crt; ssl_certificate_key cloud.tencent.com.key; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers on; location / { root html; index index.html index.htm; } } server { listen 80 ; server_name cloud.tencent.com; return 301 https://$host$request_uri; }
清除hexo缓存 hexo clean 生成静态文件 hexo generate 部署 hexo deploy