服务器安装公式转换mathlatex

一:安装mathtex

 

步骤1: 更新源

qpt-get update

apt-get upgrade

apt-get install zip

新建文件夹 

cd /

mkdir data

cd data

mkdir mathtex

cd mathtex

下载 mathtex.  :指令 wget http://www.forkosh.com/mathtex.zip

解压 unzip mathtex.zip 

步骤2:安装 dvipng

    指令 :sudo apt-get install dvipng    验证是否安装which diving

    安装tex   wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz

解压: tar -zxvf install-tl-unx.tar.gz

    cd install-tl-20200420

    ./install.tl  (要好久 2小时)

验证 which latex

    安装完毕之后

步骤3: 编译

进入到mathtex解压目录进行编译

cc -DLATEX="/usr/bin/latex" -DDVIPNG="/usr/bin/dvipng" mathtex.c -o mathtex.cgi

步骤四:

安装nginx:  apt-get install nginx

 

安装 fcgiwrap   apt-get install fcgiwrap

nginx 配置1: cp /usr/share/doc/fcgiwrap/examples/nginx.conf  /etc/nginx/fcgiwrap.conf

修改配置 fcgiwrap.conf

location /cgi-bin/ { 

  # Disable gzip (it makes scripts feel slower since they have to complete

  # before getting gzipped)

  gzip off;

 

  # Set the root to /usr/lib (inside this location this means that we are

  # giving access to the files under /usr/lib/cgi-bin)

  root  /usr/local/nginx;

 

  # Fastcgi socket

  fastcgi_pass  unix:/var/run/fcgiwrap.socket;

 

  # Fastcgi parameters, include the standard ones

  include /etc/nginx/fastcgi_params;

 

  # Adjust non standard parameters (SCRIPT_FILENAME)

  fastcgi_param SCRIPT_FILENAME  /usr/local/nginx/$fastcgi_script_name;

}

 

 

在site配置文件的server单位添加(/etc/nginx/available-sites/default):

include /etc/nginx/fcgiwrap.conf;

赋予修改cgi-bin 文件夹的能力(缓存图片)  

执行命令 :chmod  -R /usr/local/nginx/cgi-bin/ 777

最后 : nginx -s reload 

 

 

二:安装 mathjax

在项目原有的mathjax文件夹安装

先安装npm工具

apt install npm

cd 到对应的文件夹(mathjax)

npm install mathjax-node@^0.5.1

执行命令 ./star t.sh

 文件mathjax 文件夹下载 

链接:https://pan.baidu.com/s/19Y9XCtjVQqBoov-IoKwrfg  密码:08ma

如有错误,请邮件zs253499660@sina.com,如有更好的方法,可以推荐
原文地址:https://www.cnblogs.com/senjiang/p/12760179.html