Home > Hosting > Server

How to Install Clash Linux Server

2023-01-14 22:27:17

<p style="text-align: left;">Today, the editor will share with you the relevant knowledge points on how to install the Clash Linux server. After reading this article, everyone has gained something, let&#39;s take a look at it together.</p><h3 style="text-align: left;">Clash software installation</h3><h4 style="text-align: left;">Software download</h4><p style="text-align: left;">1. Use wget to download the linux installation package, save and extract it to the /opt/clash folder.</p><p style="text-align: left;">mkdir /opt/clash &amp;&amp; cd /opt/clash wget https://github.com/Dreamacro/clash/releases/download/v1.10.0/clash-linux-amd64-v1.10.0.gz unar clash-linux-amd64-v1.10.0.gz mv clash-linux-amd64-v1.10.0 clash</p><p><br/></p><p style="text-align: left;">2. Rename it to clash and give it permission to run.</p><p style="text-align: left;">chmod u+x clash</p><p><br/></p><p style="text-align: left;">3. Download the configuration information to the ~/.config/clash/ folder.</p><p style="text-align: left;">mkdir ~/.config/clash/ &amp;&amp; cd ~/.config/clash/ sudo wget -O config.yaml [subscribe link] sudo wget -O Country.mmdb https://www.sub-speeder.com/client-download/Country.mmdb</p><p><br/></p><p style="text-align: left;">4. Modify the external control setting (external-controller) address of clash to: 0.0.0.0:9990, so that both internal and external networks can access this address.</p><p style="text-align: left;"><img src="//img.freeonlinedomain.com/uploads/allimg/20230115/1-230115103233N8.png" title="" alt="6360762a8a14c.png"/></p><h3 style="text-align: left;">Setting the system proxy (method 1)</h3><p style="text-align: left;">This method will be very convenient in the future, and all the traffic will always go through the proxy software, but sometimes the network interaction will report an error , saying that the service is not trustworthy.</p><p style="text-align: left;">sudo vim /etc/environment</p><p style="text-align: left;">Add the following three lines:</p><p style="text-align: left;">export http_proxy=&quot;http://127.0.0.1:7890&quot;&nbsp;</p><p style="text-align: left;">export https_proxy=&quot;http://127.0.0.1:7890&quot;&nbsp;</p><p style="text-align: left;">export no_proxy=&quot;localhost, 127.0.0.1&quot;</p><p style="text-align: left;">Modify the sudo file</p><p style="text-align: left;">sudo vim sudo</p><p style="text-align: left;">Add at the end of the file:</p><p style="text-align: left;">Defaults env_keep+=&quot;http_proxy https_proxy no_proxy&quot;</p><p style="text-align: left;">Restart</p><p style="text-align: left;">reboot</p><p style="text-align: left;">Some programs do not use the system proxy and need to be configured separately. Let&#39;s take git as an example</p><p style="text-align: left;">git config --global http.proxy &#39;http: //127.0.0.1:7890&#39;</p><p style="text-align: left;">It is best to set the shell, take .zsh or .bashrc as an example</p><p style="text-align: left;"># .zshrc or .bashrc is added at the end&nbsp;</p><p style="text-align: left;">set proxy&nbsp;</p><p style="text-align: left;">export http_proxy=&quot;http://127.0.0.1:7890&quot;&nbsp;</p><p style="text-align: left;">export https_proxy=&quot;http://127.0.0.1:7890&quot;</p><h3 style="text-align: left;">Set system proxy (method 2, use proxychains4)</h3><p style="text-align: left;">Many operations in Linux are performed in the terminal, many programs The download of services and services needs to be carried out through commands such as npm, gem, nvm, git, etc., but the download speed in China is poor, and if it is interrupted, it has to be restarted. This situation can be improved through global FQ.</p><p style="text-align: left;">If there is no proxychains4, install the configuration</p><p style="text-align: left;"># Install the make compilation tool yum -y install gcc automake autoconf libtool make&nbsp;</p><p style="text-align: left;"># Download, you need to install git first git clone https://github.com/rofl0r/proxychains-ng.git cd proxychains-ng&nbsp;</p><p style="text-align: left;"># configuration ./configure&nbsp;</p><p style="text-align: left;"># compile and install sudo make &amp;&amp; sudo make install&nbsp;</p><p style="text-align: left;"># extract configuration file sudo cp ./src/proxychains.conf /etc/proxychains.conf # Delete the installation file cd .. &amp;&amp; rm -rf proxychains-ng&nbsp;</p><p style="text-align: left;"># Edit the configuration file (modify the last line socks5 127.0.0.1 7891) This corresponds to your proxy address sudo vim /etc/proxychains.conf</p><p style="text-align: left;">test</p><p style="text-align: left;">proxychains4 wget www.google.com #If there is no error, then the current directory will have one more index.html&nbsp;</p><p style="text-align: left;">rm index.html #clear test garbage</p><p style="text-align: left;">use</p><p style="text-align: left;">proxychains4</p><p style="text-align: left;"><command/># eg&nbsp;</p><p style="text-align: left;"># The command of the terminal is automatically proxied, exit exit proxychains4 bash&nbsp;</p><p style="text-align: left;"># Firefox browser proxy mode proxychains4 firefox&nbsp;</p><p style="text-align: left;"># git go proxy download proxychains4 git clone https://xxxxxxx</p><p style="text-align: left;">Optimize use</p><p style="text-align: left;"># Open the /etc/profile file and use alias to simplify input vim /etc/profile&nbsp;</p><p style="text-align: left;"># Add the following content at the end of the file, save and exit alias pc=&#39;proxychains4&#39;</p><p style="text-align: left;">optimized</p><p style="text-align: left;">pc<command/># eg # The command of the terminal is automatically proxied, exit exit pc bash # Firefox browser proxy mode pc firefox # git go proxy download pc git clone https://xxxxxxx</p><h4 style="text-align: left;">UI Settings</h4><p style="text-align: left;">Download the UI file in a certain folder and set the external control UI</p><p style="text-align: left;">git clone https:/ /github.com/Dreamacro/clash-dashboard.git cd clash-dashboard git checkout -b gh-pages origin/gh-pages pwd # Display the current path</p><p style="text-align: left;">Set the ui address and access password in ~/.config/clash/config.yaml</p><p style="text-align: left;">The access path is: external Control address/ui, fill in ip, port, password to access</p><p><br/></p>


Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us