﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-markqian86-随笔分类-环境配置</title><link>http://www.cppblog.com/markqian86/category/21401.html</link><description>practice makes perfect，阅读、分析、练习、总结。</description><language>zh-cn</language><lastBuildDate>Wed, 20 Jan 2021 06:13:45 GMT</lastBuildDate><pubDate>Wed, 20 Jan 2021 06:13:45 GMT</pubDate><ttl>60</ttl><item><title>centos7安装distcc和ccache</title><link>http://www.cppblog.com/markqian86/archive/2021/01/19/217577.html</link><dc:creator>长戟十三千</dc:creator><author>长戟十三千</author><pubDate>Tue, 19 Jan 2021 02:20:00 GMT</pubDate><guid>http://www.cppblog.com/markqian86/archive/2021/01/19/217577.html</guid><wfw:comment>http://www.cppblog.com/markqian86/comments/217577.html</wfw:comment><comments>http://www.cppblog.com/markqian86/archive/2021/01/19/217577.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/markqian86/comments/commentRss/217577.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/markqian86/services/trackbacks/217577.html</trackback:ping><description><![CDATA[<p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;">centos7安装distcc</p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;">依赖项：</p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;">安装g++<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />yum install -y gcc<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />yum install -y gcc-c++</p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;">python：<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />python3.1版本以上。<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />yum install -y python36</p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;">python环境<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />安装python3-devel， &nbsp; &nbsp; &nbsp;distcc安装时候需要其中的依赖<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />yum install -y python3-devel</p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;">安装libbinutils 库 &nbsp; &nbsp; &nbsp; distcc需要依赖<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />yum install -y binutils-devel</p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;">下载distcc包<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />https://distcc.github.io/&nbsp;<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />下载最新的安装包就好，我用的是distcc3.3.3</p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;">1 tar -xvf distcc-3.3.3.tar.gz<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />2 cd distcc-3.3.3<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />3 ./configure &nbsp; 如果报错Cannot find libiberty。需要安装libbinutils 库 &nbsp;<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />4 make &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;如果报错，应该是上面的安装依赖项没安装全&nbsp;<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />5 make install<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />6 ln -s ./distcc-3.3.3/distcc /usr/lib/distcc</p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;">配置：<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />vim ~/.bashrc<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />export DISTCC_HOSTS="localhost"<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />export DISTCC_POTENTIAL_HOSTS="localhost"<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />export DISTCC_LOG="./distcc.log" #编译日志</p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;">意外：如果以上都配置好了，还是连不上，关掉防火墙，重试<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />systemctl stop firewall</p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;">安装ccache<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />yum install -y ccache<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />vim ~/.bash_profile<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />PATH=/usr/lib/ccache/bin:$PATH:$HOME/bin<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" />&nbsp;</p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;">开启指令</p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-size: 16px; color: #4d4d4d; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; background-color: #ffffff; line-height: 26px !important;">distccd --daemon --allow 192.168.0.0/8 --user nobody --enable-tcp-insecure</p><img src ="http://www.cppblog.com/markqian86/aggbug/217577.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/markqian86/" target="_blank">长戟十三千</a> 2021-01-19 10:20 <a href="http://www.cppblog.com/markqian86/archive/2021/01/19/217577.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>日志备份压缩shell脚本</title><link>http://www.cppblog.com/markqian86/archive/2020/10/15/217484.html</link><dc:creator>长戟十三千</dc:creator><author>长戟十三千</author><pubDate>Thu, 15 Oct 2020 11:01:00 GMT</pubDate><guid>http://www.cppblog.com/markqian86/archive/2020/10/15/217484.html</guid><wfw:comment>http://www.cppblog.com/markqian86/comments/217484.html</wfw:comment><comments>http://www.cppblog.com/markqian86/archive/2020/10/15/217484.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/markqian86/comments/commentRss/217484.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/markqian86/services/trackbacks/217484.html</trackback:ping><description><![CDATA[<div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->#!/bin/sh<br /><span style="color: #0000FF; ">if</span>&nbsp;[&nbsp;$#&nbsp;-lt&nbsp;3&nbsp;];<br />then<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"参数个数错误：log_path&nbsp;dst_path&nbsp;timeout_day,&nbsp;例子:&nbsp;./log&nbsp;./backup&nbsp;3"<br />&nbsp;&nbsp;&nbsp;&nbsp;exit<br />fi<br /><br />#策略：3天前移动到备份并压缩<br /><br />LOG_PATH=$1<br />DST_PATH=$2<br />BACKUP_LOG_DATE=`date&nbsp;-d&nbsp;"$3&nbsp;day&nbsp;ago"&nbsp;+"%Y%m%d"`<br />echo&nbsp;$LOG_PATH&nbsp;$DST_PATH&nbsp;$BACKUP_LOG_DATE<br /><br />function&nbsp;FuncTryMkdir()<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;创建备份目录<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;test&nbsp;-d&nbsp;$1<br />&nbsp;&nbsp;&nbsp;&nbsp;then<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#echo&nbsp;"已存在目标文件夹："$1<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">else</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mkdir&nbsp;$1<br />&nbsp;&nbsp;&nbsp;&nbsp;fi<br />}<br /><br />FuncTryMkdir&nbsp;$DST_PATH<br /><br />#遍历并移动过期日志文件<br /><span style="color: #0000FF; ">for</span>&nbsp;FILE_NAME&nbsp;<span style="color: #0000FF; ">in</span>&nbsp;$LOG_PATH<span style="color: #008000; ">/*</span><span style="color: #008000; "><br />do<br />&nbsp;&nbsp;&nbsp;&nbsp;BASE_NAME=`basename&nbsp;$FILE_NAME`<br />&nbsp;&nbsp;&nbsp;&nbsp;DATA_DIR=${BASE_NAME:0-11:8}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;#N天前的文件,创建目录，并移动<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(("$DATA_DIR"&nbsp;&lt;&nbsp;"$BACKUP_LOG_DATE"));then<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BACKUP_DIR=$DST_PATH"/"$DATA_DIR"/"<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FuncTryMkdir&nbsp;$BACKUP_DIR<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mv&nbsp;$FILE_NAME&nbsp;$BACKUP_DIR<br />&nbsp;&nbsp;&nbsp;&nbsp;fi<br />done<br /><br />#遍历备份并压缩<br />cd&nbsp;$DST_PATH<br />for&nbsp;FILE_NAME&nbsp;in&nbsp;./*<br />do<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;test&nbsp;-d&nbsp;$FILE_NAME<br />&nbsp;&nbsp;&nbsp;&nbsp;then<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BASE_NAME=`basename&nbsp;$FILE_NAME`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tar&nbsp;czf&nbsp;$BASE_NAME.tar.gz&nbsp;$BASE_NAME<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rm&nbsp;-rf&nbsp;$BASE_NAME<br />&nbsp;&nbsp;&nbsp;&nbsp;fi<br />done</span></div><img src ="http://www.cppblog.com/markqian86/aggbug/217484.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/markqian86/" target="_blank">长戟十三千</a> 2020-10-15 19:01 <a href="http://www.cppblog.com/markqian86/archive/2020/10/15/217484.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用 SSH-Key 登录远程服务器</title><link>http://www.cppblog.com/markqian86/archive/2020/10/13/217479.html</link><dc:creator>长戟十三千</dc:creator><author>长戟十三千</author><pubDate>Tue, 13 Oct 2020 08:29:00 GMT</pubDate><guid>http://www.cppblog.com/markqian86/archive/2020/10/13/217479.html</guid><wfw:comment>http://www.cppblog.com/markqian86/comments/217479.html</wfw:comment><comments>http://www.cppblog.com/markqian86/archive/2020/10/13/217479.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/markqian86/comments/commentRss/217479.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/markqian86/services/trackbacks/217479.html</trackback:ping><description><![CDATA[<div><div><p>ssh 提供两种级别的安全认证：</p> <ol> <li>基于口令的安全认证</li> <li>基于密钥的安全认证</li> </ol> <h2>基于口令的安全认证</h2> <p>需要知道用户名和密码即可登录，该连接是加密的，但客户端不能确认目标主机是否为&#8220;伪造的&#8221;，也不能保证口令安全。</p> <p>远程主机的 /etc/ssh/sshd_config 需配置：</p> <div><button type="button" aria-label="复制代码"><em aria-label="icon: copy"  anticon-copy"=""><svg viewbox="64 64 896 896" focusable="false" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"></svg></em></button><pre language-undefined"=""><code language-undefined"="">PasswordAuthentication yes </code></pre></div> <p>重启 sshd 使改动生效：</p> <div><button type="button" aria-label="复制代码"><em aria-label="icon: copy"  anticon-copy"=""><svg viewbox="64 64 896 896" focusable="false" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"></svg></em></button><pre language-kotlin"=""><code language-kotlin"="">$ <span operator"="">/</span>etc<span operator"="">/</span><span keyword"="">init</span><span punctuation"="">.</span>d<span operator"="">/</span>sshd reload </code></pre></div> <h2>基于密钥的安全认证</h2> <p>需要用户持有&#8220;公钥/私钥对&#8221;，远程服务器持有公钥，本地持有私钥。</p> <p>客户端向服务器发出请求。服务器收到请求之后，先在用户的主目录下找到该用户的公钥，然后对比用户发送过来的公钥。如果一致，服务器用公钥加密&#8220;质询&#8221;并发送给客户端。客户端收到&#8220;质询&#8221;后用私钥解密，再发还给服务器。认证结束。</p> <p>生成 ssh-key，选加密算法（rsa、dsa），给秘钥命名（可选）：</p> <div><button type="button" aria-label="复制代码"><em aria-label="icon: copy"  anticon-copy"=""><svg viewbox="64 64 896 896" focusable="false" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"></svg></em></button><pre language-ruby"=""><code language-ruby"="">$ ssh<span operator"="">-</span>keygen <span operator"="">-</span>t rsa <span operator"="">-</span><span constant"="">C</span> <span string"="">"name"</span> </code></pre></div> <p>passphrase 是证书口令，以加强安全性，避免证书被恶意复制。</p> <p>会在 <code>~.ssh</code> 下生成 <code>id_rsa</code>, <code>id_rsa.pub</code> 两个文件，分别是 私钥/公钥。</p> <p>公钥需保存到远程服务器 <code>~/.ssh/authorized_keys</code> 里，私钥由客户端本地留存。</p> <p>要保证 <code>.ssh</code> 和 <code>authorized_keys</code> 都只有用户自己有写权限。否则验证无效。</p> <div><button type="button" aria-label="复制代码"><em aria-label="icon: copy"  anticon-copy"=""><svg viewbox="64 64 896 896" focusable="false" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"></svg></em></button><pre language-ruby"=""><code language-ruby"="">$ chmod <span operator"="">-</span><span constant"="">R</span> <span number"="">700</span> <span operator"="">~</span><span regex"="">/.ssh/</span> $ chmod <span number"="">600</span> <span operator"="">~</span><span operator"="">/</span><span punctuation"="">.</span>ssh<span operator"="">/</span>authorized_keys </code></pre></div> <h2>ssh 配置的一些实践</h2> <div><button type="button" aria-label="复制代码"><em aria-label="icon: copy"  anticon-copy"=""><svg viewbox="64 64 896 896" focusable="false" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"></svg></em></button><pre language-ruby"=""><code language-ruby"="">$ vim <span operator"="">/</span>etc<span operator"="">/</span>ssh<span operator"="">/</span>sshd_config  <span comment"=""># 禁用root账户登录，非必要，但为了安全性，请配置</span> <span constant"="">PermitRootLogin</span> no  <span comment"=""># 是否让 sshd 去检查用户家目录或相关档案的权限数据，这是为了担心使用者将某些重要档案的权限设错，可能会导致一些问题所致。例如使用者的 ~/.ssh/ 权限设错时，某些特殊情况下会不许用户登入</span> <span constant"="">StrictModes</span> no  <span comment"=""># 是否允许用户自行使用成对的密钥系统进行登入行为，仅针对 version 2。至于自制的公钥数据就放置于用户家目录下的 .ssh/authorized_keys 内</span> <span constant"="">RSAAuthentication</span> yes <span constant"="">PubkeyAuthentication</span> yes <span constant"="">AuthorizedKeysFile</span> <span operator"="">%</span>h<span operator"="">/</span><span punctuation"="">.</span>ssh<span operator"="">/</span>authorized_keys  <span comment"=""># 有了证书登录了，就禁用密码登录吧，安全要紧</span> <span constant"="">PasswordAuthentication</span> no </code></pre></div> <h2>持有多个 ssh-key 时的使用方法</h2> <p>简单情况下，通过手动指定私钥文件登录</p> <div><button type="button" aria-label="复制代码"><em aria-label="icon: copy"  anticon-copy"=""><svg viewbox="64 64 896 896" focusable="false" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"></svg></em></button><pre language-ruby"=""><code language-ruby"="">$ ssh username<span variable"="">@hostname</span> <span operator"="">-</span>i <span operator"="">~</span><span operator"="">/</span><span punctuation"="">.</span>ssh<span operator"="">/</span>my_id_rsa </code></pre></div> <p>觉得麻烦可以配置客户端的 <code>/etc/ssh/ssh_config</code></p> <div><button type="button" aria-label="复制代码"><em aria-label="icon: copy"  anticon-copy"=""><svg viewbox="64 64 896 896" focusable="false" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"></svg></em></button><pre language-ruby"=""><code language-ruby"=""><span comment"=""># 其实默认 id_rsa 已经加入私钥路径了，这里只是示范</span> <span constant"="">IdentityFile</span> <span operator"="">~</span><span operator"="">/</span><span punctuation"="">.</span>ssh<span operator"="">/</span>id_rsa <span comment"=""># 如果有其他的私钥，再加入其他私钥的路径</span> <span constant"="">IdentityFile</span> <span operator"="">~</span><span operator"="">/</span><span punctuation"="">.</span>ssh<span operator"="">/</span>my_id_rsa </code></pre></div> <p>你也可以使用 SSH Agent，下面以使用 GitHub 为场景简单介绍。</p> <div><button type="button" aria-label="复制代码"><em aria-label="icon: copy"  anticon-copy"=""><svg viewbox="64 64 896 896" focusable="false" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"></svg></em></button><pre language-ruby"=""><code language-ruby"="">$ ssh<span operator"="">-</span>keygen <span operator"="">-</span>t rsa <span operator"="">-</span><span constant"="">C</span> <span string"="">'second@mail.com'</span> $ ssh<span operator"="">-</span>add ～<span operator"="">/</span><span punctuation"="">.</span>ssh<span operator"="">/</span>id_rsa_second </code></pre></div> <p>创建 <code>~/.ssh/config</code></p> <div><button type="button" aria-label="复制代码"><em aria-label="icon: copy"  anticon-copy"=""><svg viewbox="64 64 896 896" focusable="false" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"></svg></em></button><pre language-ruby"=""><code language-ruby"=""><span comment"=""># Default github user(first@mail.com)</span> <span constant"="">Host</span> github<span punctuation"="">.</span>com <span constant"="">HostName</span> github<span punctuation"="">.</span>com <span constant"="">User</span> git <span constant"="">IdentityFile</span> <span constant"="">C</span><span punctuation"="">:</span><span operator"="">/</span><span constant"="">Users</span><span regex"="">/username/</span><span punctuation"="">.</span>ssh<span operator"="">/</span>id_rsa  <span comment"=""># second user(second@mail.com)</span> <span constant"="">Host</span> github<span operator"="">-</span>second <span constant"="">HostName</span> github<span punctuation"="">.</span>com <span constant"="">User</span> git <span constant"="">IdentityFile</span> <span constant"="">C</span><span punctuation"="">:</span><span operator"="">/</span><span constant"="">Users</span><span regex"="">/username/</span><span punctuation"="">.</span>ssh<span operator"="">/</span>id_rsa_second </code></pre></div> <p>配置完成后，在连接非默认账号的仓库时，远端地址要修改为</p> <div><button type="button" aria-label="复制代码"><em aria-label="icon: copy"  anticon-copy"=""><svg viewbox="64 64 896 896" focusable="false" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"></svg></em></button><pre language-ruby"=""><code language-ruby"="">git remote add test git<span variable"="">@github</span><span operator"="">-</span>second<span symbol"="">:second</span><span operator"="">/</span>test<span punctuation"="">.</span>git <span comment"=""># 原来是 git@github.com:second/test.git</span> <span comment"=""># git 根据配置的 user.email 来获取 github 帐号来显示 author 信息，记得将 user.email 改为相应的 email</span></code></pre></div></div><br /><br />作者：字母数字或汉字<br />链接：https://www.jianshu.com/p/fab3252b3192<br />来源：简书<br />著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。</div><img src ="http://www.cppblog.com/markqian86/aggbug/217479.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/markqian86/" target="_blank">长戟十三千</a> 2020-10-13 16:29 <a href="http://www.cppblog.com/markqian86/archive/2020/10/13/217479.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Linux下使用SSH密钥连接Github</title><link>http://www.cppblog.com/markqian86/archive/2020/09/03/217436.html</link><dc:creator>长戟十三千</dc:creator><author>长戟十三千</author><pubDate>Thu, 03 Sep 2020 03:26:00 GMT</pubDate><guid>http://www.cppblog.com/markqian86/archive/2020/09/03/217436.html</guid><wfw:comment>http://www.cppblog.com/markqian86/comments/217436.html</wfw:comment><comments>http://www.cppblog.com/markqian86/archive/2020/09/03/217436.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/markqian86/comments/commentRss/217436.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/markqian86/services/trackbacks/217436.html</trackback:ping><description><![CDATA[<div itemprop="articleBody" style="font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; overflow-wrap: break-word; font-size: 1.125em; text-align: justify; opacity: 1; color: #555555; background-color: #ffffff; transform: translateY(0px);"><p style="margin: 0px 0px 20px;">在 Linux 系统下如何通过 SSH 密钥来连接 GitHub (Mac系统下设置方法相同)。</p><h4><a href="https://www.itfanr.cc/2017/03/03/using-ssh-key-connection-github-in-linux/#%E5%BC%95%E7%94%B3" title="引申" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;"></a>引申</h4><ul><li>Linux下 ：<a href="https://www.itfanr.cc/2017/03/03/using-ssh-key-connection-github-in-linux/" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;">Linux下使用SSH密钥连接Github</a></li><li>Windows下：<a href="https://www.itfanr.cc/2016/09/24/using-ssh-key-connection-github/" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;">使用SSH密钥连接Github</a></li></ul><hr style="box-sizing: content-box; height: 2px; overflow: visible; background-image: repeating-linear-gradient(-45deg, #dddddd, #dddddd 4px, transparent 4px, transparent 8px); border: 0px; margin: 20px 0px;" /><h4><a href="https://www.itfanr.cc/2017/03/03/using-ssh-key-connection-github-in-linux/#Ubuntu-%E7%B3%BB%E7%BB%9F%E5%88%9D%E5%A7%8B%E5%8C%96%E9%85%8D%E7%BD%AEgit%E7%8E%AF%E5%A2%83" title="Ubuntu 系统初始化配置git环境" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;"></a>Ubuntu 系统初始化配置git环境</h4><p style="margin: 0px 0px 20px;">测试系统版本 :&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">Ubuntu 16.04 LTS</code></p><h5><a href="https://www.itfanr.cc/2017/03/03/using-ssh-key-connection-github-in-linux/#%E6%9B%B4%E6%96%B0%E8%BD%AF%E4%BB%B6%E6%BA%90" title="更新软件源" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;"></a>更新软件源</h5><div style="position: relative; background: #21252b; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.4) 0px 10px 30px 0px; padding-top: 30px;"><figure plain"="" style="background: #2d2d2d; color: #cccccc; line-height: 1.6; margin: 0px auto 20px; border-radius: 0px 0px 5px 5px;"><div style="overflow: auto; border-radius: 0px 0px 5px 5px;"><table style="border-collapse: collapse; border-spacing: 0px; font-size: 0.875em; margin: 0px; width: auto; border-width: 0px; border-style: initial; border-color: initial;"><tbody><tr style="background: var(--table-row-odd-bg-color);"><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial; user-select: none;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #1b1b1b; color: #999999; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px; border: 0px;">1<br />2<br />3<br /></pre></td><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #cccccc; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px 0px 10px 10px; border: 0px; width: 1128px;">$ echo "deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse" &gt;&gt; /etc/apt/sources.list &amp;&amp; \<br />echo "deb http://cn.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse" &gt;&gt; /etc/apt/sources.list &amp;&amp; \<br />echo "deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse" &gt;&gt; /etc/apt/sources.list<br /></pre></td></tr></tbody></table></div></figure><div style="cursor: pointer; line-height: 1.6; opacity: 0; padding: 2px 6px; position: absolute; transition-delay: 0s; transition-duration: 0.2s; transition-timing-function: ease-in-out; color: #ffffff; font-size: 14px; right: 0px; top: 2px;"></div></div><h5><a href="https://www.itfanr.cc/2017/03/03/using-ssh-key-connection-github-in-linux/#%E5%AE%89%E8%A3%85git%E4%BE%9D%E8%B5%96" title="安装git依赖" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;"></a>安装git依赖</h5><div style="position: relative; background: #21252b; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.4) 0px 10px 30px 0px; padding-top: 30px;"><figure plain"="" style="background: #2d2d2d; color: #cccccc; line-height: 1.6; margin: 0px auto 20px; border-radius: 0px 0px 5px 5px;"><div style="overflow: auto; border-radius: 0px 0px 5px 5px;"><table style="border-collapse: collapse; border-spacing: 0px; font-size: 0.875em; margin: 0px; width: auto; border-width: 0px; border-style: initial; border-color: initial;"><tbody><tr style="background: var(--table-row-odd-bg-color);"><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial; user-select: none;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #1b1b1b; color: #999999; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px; border: 0px;">1<br />2<br /></pre></td><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #cccccc; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px 0px 10px 10px; border: 0px; width: 192px;">$ apt-get update<br />$ apt-get install git<br /></pre></td></tr></tbody></table></div></figure><div style="cursor: pointer; line-height: 1.6; opacity: 0; padding: 2px 6px; position: absolute; transition-delay: 0s; transition-duration: 0.2s; transition-timing-function: ease-in-out; color: #ffffff; font-size: 14px; right: 0px; top: 2px;"></div></div><h5><a href="https://www.itfanr.cc/2017/03/03/using-ssh-key-connection-github-in-linux/#%E8%AE%BE%E7%BD%AE%E6%97%B6%E5%8C%BA" title="设置时区" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;"></a>设置时区</h5><div style="position: relative; background: #21252b; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.4) 0px 10px 30px 0px; padding-top: 30px;"><figure plain"="" style="background: #2d2d2d; color: #cccccc; line-height: 1.6; margin: 0px auto 20px; border-radius: 0px 0px 5px 5px;"><div style="overflow: auto; border-radius: 0px 0px 5px 5px;"><table style="border-collapse: collapse; border-spacing: 0px; font-size: 0.875em; margin: 0px; width: auto; border-width: 0px; border-style: initial; border-color: initial;"><tbody><tr style="background: var(--table-row-odd-bg-color);"><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial; user-select: none;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #1b1b1b; color: #999999; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px; border: 0px;">1<br />2<br />3<br /></pre></td><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #cccccc; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px 0px 10px 10px; border: 0px; width: 504px;">$ ln -sf /usr/share/zoneinfo/Asia/ShangHai /etc/localtime<br />$ echo "Asia/Shanghai" &gt; /etc/timezone<br />$ dpkg-reconfigure -f noninteractive tzdata<br /></pre></td></tr></tbody></table></div></figure><div style="cursor: pointer; line-height: 1.6; opacity: 0; padding: 2px 6px; position: absolute; transition-delay: 0s; transition-duration: 0.2s; transition-timing-function: ease-in-out; color: #ffffff; font-size: 14px; right: 0px; top: 2px;"></div></div><hr style="box-sizing: content-box; height: 2px; overflow: visible; background-image: repeating-linear-gradient(-45deg, #dddddd, #dddddd 4px, transparent 4px, transparent 8px); border: 0px; margin: 20px 0px;" /><h4><a href="https://www.itfanr.cc/2017/03/03/using-ssh-key-connection-github-in-linux/#Alpine-%E7%B3%BB%E7%BB%9F%E5%88%9D%E5%A7%8B%E5%8C%96%E9%85%8D%E7%BD%AEgit%E7%8E%AF%E5%A2%83" title="Alpine 系统初始化配置git环境" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;"></a>Alpine 系统初始化配置git环境</h4><p style="margin: 0px 0px 20px;">测试系统版本 :&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">Alpine 3.5</code></p><h5><a href="https://www.itfanr.cc/2017/03/03/using-ssh-key-connection-github-in-linux/#%E6%9B%B4%E6%96%B0%E8%BD%AF%E4%BB%B6%E6%BA%90-1" title="更新软件源" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;"></a>更新软件源</h5><div style="position: relative; background: #21252b; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.4) 0px 10px 30px 0px; padding-top: 30px;"><figure plain"="" style="background: #2d2d2d; color: #cccccc; line-height: 1.6; margin: 0px auto 20px; border-radius: 0px 0px 5px 5px;"><div style="overflow: auto; border-radius: 0px 0px 5px 5px;"><table style="border-collapse: collapse; border-spacing: 0px; font-size: 0.875em; margin: 0px; width: auto; border-width: 0px; border-style: initial; border-color: initial;"><tbody><tr style="background: var(--table-row-odd-bg-color);"><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial; user-select: none;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #1b1b1b; color: #999999; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px; border: 0px;">1<br />2<br /></pre></td><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #cccccc; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px 0px 10px 10px; border: 0px; width: 729px;">$ echo "http://dl-4.alpinelinux.org/alpine/v3.5/main" &gt;&gt; /etc/apk/repositories<br />$ echo "http://dl-4.alpinelinux.org/alpine/v3.5/community" &gt;&gt; /etc/apk/repositories<br /></pre></td></tr></tbody></table></div></figure><div style="cursor: pointer; line-height: 1.6; opacity: 0; padding: 2px 6px; position: absolute; transition-delay: 0s; transition-duration: 0.2s; transition-timing-function: ease-in-out; color: #ffffff; font-size: 14px; right: 0px; top: 2px;"></div></div><h5><a href="https://www.itfanr.cc/2017/03/03/using-ssh-key-connection-github-in-linux/#%E5%AE%89%E8%A3%85%E4%BE%9D%E8%B5%96" title="安装依赖" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;"></a>安装依赖</h5><p style="margin: 0px 0px 20px;">The&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">ssh-keygen</code>&nbsp;command is part of&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">OpenSSH</code>&nbsp;(package &#8220;openssh&#8221;).</p><div style="position: relative; background: #21252b; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.4) 0px 10px 30px 0px; padding-top: 30px;"><figure plain"="" style="background: #2d2d2d; color: #cccccc; line-height: 1.6; margin: 0px auto 20px; border-radius: 0px 0px 5px 5px;"><div style="overflow: auto; border-radius: 0px 0px 5px 5px;"><table style="border-collapse: collapse; border-spacing: 0px; font-size: 0.875em; margin: 0px; width: auto; border-width: 0px; border-style: initial; border-color: initial;"><tbody><tr style="background: var(--table-row-odd-bg-color);"><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial; user-select: none;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #1b1b1b; color: #999999; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px; border: 0px;">1<br />2<br /></pre></td><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #cccccc; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px 0px 10px 10px; border: 0px; width: 192px;">$ apk update<br />$ apk add git openssh<br /></pre></td></tr></tbody></table></div></figure><div style="cursor: pointer; line-height: 1.6; opacity: 0; padding: 2px 6px; position: absolute; transition-delay: 0s; transition-duration: 0.2s; transition-timing-function: ease-in-out; color: #ffffff; font-size: 14px; right: 0px; top: 2px;"></div></div><h5><a href="https://www.itfanr.cc/2017/03/03/using-ssh-key-connection-github-in-linux/#%E8%AE%BE%E7%BD%AE%E6%97%B6%E5%8C%BA-1" title="设置时区" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;"></a>设置时区</h5><div style="position: relative; background: #21252b; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.4) 0px 10px 30px 0px; padding-top: 30px;"><figure plain"="" style="background: #2d2d2d; color: #cccccc; line-height: 1.6; margin: 0px auto 20px; border-radius: 0px 0px 5px 5px;"><div style="overflow: auto; border-radius: 0px 0px 5px 5px;"><table style="border-collapse: collapse; border-spacing: 0px; font-size: 0.875em; margin: 0px; width: auto; border-width: 0px; border-style: initial; border-color: initial;"><tbody><tr style="background: var(--table-row-odd-bg-color);"><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial; user-select: none;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #1b1b1b; color: #999999; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px; border: 0px;">1<br />2<br />3<br /></pre></td><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #cccccc; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px 0px 10px 10px; border: 0px; width: 504px;">$ apk add tzdata<br />$ ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime<br />$ echo "Asia/Shanghai" &gt; /etc/timezone<br /></pre></td></tr></tbody></table></div></figure><div style="cursor: pointer; line-height: 1.6; opacity: 0; padding: 2px 6px; position: absolute; transition-delay: 0s; transition-duration: 0.2s; transition-timing-function: ease-in-out; color: #ffffff; font-size: 14px; right: 0px; top: 2px;"></div></div><hr style="box-sizing: content-box; height: 2px; overflow: visible; background-image: repeating-linear-gradient(-45deg, #dddddd, #dddddd 4px, transparent 4px, transparent 8px); border: 0px; margin: 20px 0px;" /><h4><a href="https://www.itfanr.cc/2017/03/03/using-ssh-key-connection-github-in-linux/#Mac-%E7%B3%BB%E7%BB%9F%E5%88%9D%E5%A7%8B%E5%8C%96%E9%85%8D%E7%BD%AEgit%E7%8E%AF%E5%A2%83" title="Mac 系统初始化配置git环境" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;"></a>Mac 系统初始化配置git环境</h4><p style="margin: 0px 0px 20px;">Mac系统上安装git,可以直接从git网站下载安装包,访问&nbsp;<a href="https://git-scm.com/download/mac" target="_blank" rel="noopener" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;">Git - Downloads</a>&nbsp;安装.</p><p style="margin: 0px 0px 20px;">也可以通过&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">homebrew</code>&nbsp;进行安装:</p><div style="position: relative; background: #21252b; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.4) 0px 10px 30px 0px; padding-top: 30px;"><figure plain"="" style="background: #2d2d2d; color: #cccccc; line-height: 1.6; margin: 0px auto 20px; border-radius: 0px 0px 5px 5px;"><div style="overflow: auto; border-radius: 0px 0px 5px 5px;"><table style="border-collapse: collapse; border-spacing: 0px; font-size: 0.875em; margin: 0px; width: auto; border-width: 0px; border-style: initial; border-color: initial;"><tbody><tr style="background: var(--table-row-odd-bg-color);"><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial; user-select: none;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #1b1b1b; color: #999999; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px; border: 0px;">1<br /></pre></td><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #cccccc; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px 0px 10px 10px; border: 0px; width: 166px;">$ brew install git<br /></pre></td></tr></tbody></table></div></figure><div style="cursor: pointer; line-height: 1.6; opacity: 0; padding: 2px 6px; position: absolute; transition-delay: 0s; transition-duration: 0.2s; transition-timing-function: ease-in-out; color: #ffffff; font-size: 14px; right: 0px; top: 2px;"></div></div><hr style="box-sizing: content-box; height: 2px; overflow: visible; background-image: repeating-linear-gradient(-45deg, #dddddd, #dddddd 4px, transparent 4px, transparent 8px); border: 0px; margin: 20px 0px;" /><h4><a href="https://www.itfanr.cc/2017/03/03/using-ssh-key-connection-github-in-linux/#%E8%AE%BE%E7%BD%AEgit%E8%B4%A6%E6%88%B7" title="设置git账户" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;"></a>设置git账户</h4><p style="margin: 0px 0px 20px;">执行如下两条命令设置git账户的用户名和密码：</p><div style="position: relative; background: #21252b; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.4) 0px 10px 30px 0px; padding-top: 30px;"><figure plain"="" style="background: #2d2d2d; color: #cccccc; line-height: 1.6; margin: 0px auto 20px; border-radius: 0px 0px 5px 5px;"><div style="overflow: auto; border-radius: 0px 0px 5px 5px;"><table style="border-collapse: collapse; border-spacing: 0px; font-size: 0.875em; margin: 0px; width: auto; border-width: 0px; border-style: initial; border-color: initial;"><tbody><tr style="background: var(--table-row-odd-bg-color);"><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial; user-select: none;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #1b1b1b; color: #999999; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px; border: 0px;">1<br />2<br />3<br />4<br /></pre></td><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #cccccc; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px 0px 10px 10px; border: 0px; width: 487px;">$ git config --global user.name "Your Name"<br />$ git config --global user.email "youremail@domain.com"<br /><br />$ git config --list<br /></pre></td></tr></tbody></table></div></figure><div style="cursor: pointer; line-height: 1.6; opacity: 0; padding: 2px 6px; position: absolute; transition-delay: 0s; transition-duration: 0.2s; transition-timing-function: ease-in-out; color: #ffffff; font-size: 14px; right: 0px; top: 2px;"></div></div><hr style="box-sizing: content-box; height: 2px; overflow: visible; background-image: repeating-linear-gradient(-45deg, #dddddd, #dddddd 4px, transparent 4px, transparent 8px); border: 0px; margin: 20px 0px;" /><h4><a href="https://www.itfanr.cc/2017/03/03/using-ssh-key-connection-github-in-linux/#%E7%94%9F%E6%88%90SSH%E5%85%AC%E9%92%A5" title="生成SSH公钥" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;"></a>生成SSH公钥</h4><p style="margin: 0px 0px 20px;">SSH 公钥默认储存在账户的主目录下的&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">~/.ssh</code>&nbsp;目录。先确认是否已经有一个公钥了：</p><div style="position: relative; background: #21252b; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.4) 0px 10px 30px 0px; padding-top: 30px;"><figure plain"="" style="background: #2d2d2d; color: #cccccc; line-height: 1.6; margin: 0px auto 20px; border-radius: 0px 0px 5px 5px;"><div style="overflow: auto; border-radius: 0px 0px 5px 5px;"><table style="border-collapse: collapse; border-spacing: 0px; font-size: 0.875em; margin: 0px; width: auto; border-width: 0px; border-style: initial; border-color: initial;"><tbody><tr style="background: var(--table-row-odd-bg-color);"><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial; user-select: none;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #1b1b1b; color: #999999; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px; border: 0px;">1<br />2<br /></pre></td><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #cccccc; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px 0px 10px 10px; border: 0px; width: 314px;">$ cd ~/.ssh<br />/bin/sh: cd: can't cd to /root/.ssh<br /></pre></td></tr></tbody></table></div></figure><div style="cursor: pointer; line-height: 1.6; opacity: 0; padding: 2px 6px; position: absolute; transition-delay: 0s; transition-duration: 0.2s; transition-timing-function: ease-in-out; color: #ffffff; font-size: 14px; right: 0px; top: 2px;"></div></div><p style="margin: 0px 0px 20px;">主要是看是否存在&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">id_dsa</code>&nbsp;或&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">id_rsa</code>&nbsp;文件。有&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">.pub</code>&nbsp;后缀的文件就是&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">公钥</code>，另一个文件则是密钥。</p><h5><a href="https://www.itfanr.cc/2017/03/03/using-ssh-key-connection-github-in-linux/#%E5%88%9B%E5%BB%BA%E6%96%B0%E7%9A%84SSH%E5%AF%86%E9%92%A5" title="创建新的SSH密钥" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;"></a>创建新的SSH密钥</h5><p style="margin: 0px 0px 20px;">如果已经存在公钥，可跳过这步。如果没有，使用&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">ssh-keygen</code>&nbsp;来创建：</p><div style="position: relative; background: #21252b; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.4) 0px 10px 30px 0px; padding-top: 30px;"><figure plain"="" style="background: #2d2d2d; color: #cccccc; line-height: 1.6; margin: 0px auto 20px; border-radius: 0px 0px 5px 5px;"><div style="overflow: auto; border-radius: 0px 0px 5px 5px;"><table style="border-collapse: collapse; border-spacing: 0px; font-size: 0.875em; margin: 0px; width: auto; border-width: 0px; border-style: initial; border-color: initial;"><tbody><tr style="background: var(--table-row-odd-bg-color);"><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial; user-select: none;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #1b1b1b; color: #999999; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px; border: 0px;">1<br />2<br /></pre></td><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #cccccc; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px 0px 10px 10px; border: 0px; width: 400px;">$ cd ~<br />$ ssh-keygen -t rsa -C "youremail@domain.com"<br /></pre></td></tr></tbody></table></div></figure><div style="cursor: pointer; line-height: 1.6; opacity: 0; padding: 2px 6px; position: absolute; transition-delay: 0s; transition-duration: 0.2s; transition-timing-function: ease-in-out; color: #ffffff; font-size: 14px; right: 0px; top: 2px;"></div></div><p style="margin: 0px 0px 20px;">示例：(<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">xxxxxx@126.com</code>&nbsp;为我的账户邮箱)</p><div style="position: relative; background: #21252b; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.4) 0px 10px 30px 0px; padding-top: 30px;"><figure plain"="" style="background: #2d2d2d; color: #cccccc; line-height: 1.6; margin: 0px auto 20px; border-radius: 0px 0px 5px 5px;"><div style="overflow: auto; border-radius: 0px 0px 5px 5px;"><table style="border-collapse: collapse; border-spacing: 0px; font-size: 0.875em; margin: 0px; width: auto; border-width: 0px; border-style: initial; border-color: initial;"><tbody><tr style="background: var(--table-row-odd-bg-color);"><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial; user-select: none;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #1b1b1b; color: #999999; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px; border: 0px;">1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br /></pre></td><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #cccccc; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px 0px 10px 10px; border: 0px; width: 1097px;">~ # ssh-keygen -t rsa -C "xxxxxx@126.com"<br />Generating public/private rsa key pair.<br />Enter file in which to save the key (/root/.ssh/id_rsa): # 直接回车，则将密钥按默认路径及文件名进行存储。此时也可以输入特定的文件名<br />Created directory '/root/.ssh'.<br />Enter passphrase (empty for no passphrase):  # 根据提示，你需要输入密码和确认密码。可以不填，设置为空值，直接回车<br />Enter same passphrase again: <br />Your identification has been saved in /root/.ssh/id_rsa.<br />Your public key has been saved in /root/.ssh/id_rsa.pub.<br />The key fingerprint is:<br />SHA256:yFt14TcP0H+ixy9VKiILPPJ6DVevkKgrbxVFqk7mn5k xxxxxx@126.com<br />The key's randomart image is:<br />+---[RSA 2048]----+<br />|            o.   |<br />|      .    . o.  |<br />|     o    . o +. |<br />|    .... ... ..++|<br />|   . o .So .   o+|<br />|  + o Bo= . + + .|<br />| =   *.* +   o o |<br />|  ++o o o .   . .|<br />|  E=++         . |<br />+----[SHA256]-----+<br /></pre></td></tr></tbody></table></div></figure><div style="cursor: pointer; line-height: 1.6; opacity: 0; padding: 2px 6px; position: absolute; transition-delay: 0s; transition-duration: 0.2s; transition-timing-function: ease-in-out; color: #ffffff; font-size: 14px; right: 0px; top: 2px;"></div></div><p style="margin: 0px 0px 20px;">查看生成的文件：</p><div style="position: relative; background: #21252b; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.4) 0px 10px 30px 0px; padding-top: 30px;"><figure plain"="" style="background: #2d2d2d; color: #cccccc; line-height: 1.6; margin: 0px auto 20px; border-radius: 0px 0px 5px 5px;"><div style="overflow: auto; border-radius: 0px 0px 5px 5px;"><table style="border-collapse: collapse; border-spacing: 0px; font-size: 0.875em; margin: 0px; width: auto; border-width: 0px; border-style: initial; border-color: initial;"><tbody><tr style="background: var(--table-row-odd-bg-color);"><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial; user-select: none;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #1b1b1b; color: #999999; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px; border: 0px;">1<br />2<br />3<br /></pre></td><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #cccccc; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px 0px 10px 10px; border: 0px; width: 201px;">$ cd ~/.ssh<br />~/.ssh $ ls<br />id_rsa      id_rsa.pub<br /></pre></td></tr></tbody></table></div></figure><div style="cursor: pointer; line-height: 1.6; opacity: 0; padding: 2px 6px; position: absolute; transition-delay: 0s; transition-duration: 0.2s; transition-timing-function: ease-in-out; color: #ffffff; font-size: 14px; right: 0px; top: 2px;"></div></div><p style="margin: 0px 0px 20px;">文件&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">id_rsa.pub</code>&nbsp;就是公钥。</p><hr style="box-sizing: content-box; height: 2px; overflow: visible; background-image: repeating-linear-gradient(-45deg, #dddddd, #dddddd 4px, transparent 4px, transparent 8px); border: 0px; margin: 20px 0px;" /><h4><a href="https://www.itfanr.cc/2017/03/03/using-ssh-key-connection-github-in-linux/#%E5%9C%A8-GibHub-%E4%B8%AD%E6%B7%BB%E5%8A%A0%E4%BD%A0%E7%9A%84%E5%85%AC%E9%92%A5" title="在 GibHub 中添加你的公钥" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;"></a>在 GibHub 中添加你的公钥</h4><p style="margin: 0px 0px 20px;">复制公钥&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">id_rsa.pub</code>&nbsp;文件中的内容。</p><p style="margin: 0px 0px 20px;">我这里使用&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">XShell</code>&nbsp;来登录的linux服务器，可以直接复制出来。或在&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">vim</code>&nbsp;下，可通过命令&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">ggVG</code>&nbsp;全选，<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">+y</code>&nbsp;复制选中内容到+寄存器，也就是系统的剪贴板，供其他程序使用。</p><p style="margin: 0px 0px 20px;">登陆Github网站，选择&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">Settings</code>&nbsp;&#8211;&gt;&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">SSH and GPG keys</code>&nbsp;菜单，点击&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">New SSH key</code>&nbsp;按钮。<br />粘贴你的密钥到&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">Key</code>&nbsp;输入框中并设置&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">Title</code>&nbsp;信息，点击&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">Add SSH key</code>&nbsp;按钮完成。</p><hr style="box-sizing: content-box; height: 2px; overflow: visible; background-image: repeating-linear-gradient(-45deg, #dddddd, #dddddd 4px, transparent 4px, transparent 8px); border: 0px; margin: 20px 0px;" /><h4><a href="https://www.itfanr.cc/2017/03/03/using-ssh-key-connection-github-in-linux/#%E8%BF%9E%E6%8E%A5%E6%B5%8B%E8%AF%95" title="连接测试" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;"></a>连接测试</h4><p style="margin: 0px 0px 20px;">测试 SSH keys 是否设置成功，执行如下命令：</p><div style="position: relative; background: #21252b; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.4) 0px 10px 30px 0px; padding-top: 30px;"><figure plain"="" style="background: #2d2d2d; color: #cccccc; line-height: 1.6; margin: 0px auto 20px; border-radius: 0px 0px 5px 5px;"><div style="overflow: auto; border-radius: 0px 0px 5px 5px;"><table style="border-collapse: collapse; border-spacing: 0px; font-size: 0.875em; margin: 0px; width: auto; border-width: 0px; border-style: initial; border-color: initial;"><tbody><tr style="background: var(--table-row-odd-bg-color);"><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial; user-select: none;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #1b1b1b; color: #999999; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px; border: 0px;">1<br /></pre></td><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #cccccc; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px 0px 10px 10px; border: 0px; width: 210px;">$ ssh -T git@github.com<br /></pre></td></tr></tbody></table></div></figure><div style="cursor: pointer; line-height: 1.6; opacity: 0; padding: 2px 6px; position: absolute; transition-delay: 0s; transition-duration: 0.2s; transition-timing-function: ease-in-out; color: #ffffff; font-size: 14px; right: 0px; top: 2px;"></div></div><p style="margin: 0px 0px 20px;">当提示如下信息时，说明正常连通了github:</p><div style="position: relative; background: #21252b; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.4) 0px 10px 30px 0px; padding-top: 30px;"><figure plain"="" style="background: #2d2d2d; color: #cccccc; line-height: 1.6; margin: 0px auto 20px; border-radius: 0px 0px 5px 5px;"><div style="overflow: auto; border-radius: 0px 0px 5px 5px;"><table style="border-collapse: collapse; border-spacing: 0px; font-size: 0.875em; margin: 0px; width: auto; border-width: 0px; border-style: initial; border-color: initial;"><tbody><tr style="background: var(--table-row-odd-bg-color);"><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial; user-select: none;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #1b1b1b; color: #999999; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px; border: 0px;">1<br /></pre></td><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #cccccc; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px 0px 10px 10px; border: 0px; width: 764px;">Hi xxxxxx! You've successfully authenticated, but GitHub does not provide shell access.<br /></pre></td></tr></tbody></table></div></figure><div style="cursor: pointer; line-height: 1.6; opacity: 0; padding: 2px 6px; position: absolute; transition-delay: 0s; transition-duration: 0.2s; transition-timing-function: ease-in-out; color: #ffffff; font-size: 14px; right: 0px; top: 2px;"></div></div><p style="margin: 0px 0px 20px;">如果你是第一次设置连接github.com,会询问你是否继续,输入&nbsp;<code style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #eeeeee; border-radius: 3px; padding: 2px 4px; overflow-wrap: break-word;">yes</code>&nbsp;即可,这样就会将连接地址记录在本地:</p><div style="position: relative; background: #21252b; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.4) 0px 10px 30px 0px; padding-top: 30px;"><figure plain"="" style="background: #2d2d2d; color: #cccccc; line-height: 1.6; margin: 0px auto 20px; border-radius: 0px 0px 5px 5px;"><div style="overflow: auto; border-radius: 0px 0px 5px 5px;"><table style="border-collapse: collapse; border-spacing: 0px; font-size: 0.875em; margin: 0px; width: auto; border-width: 0px; border-style: initial; border-color: initial;"><tbody><tr style="background: var(--table-row-odd-bg-color);"><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial; user-select: none;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background: #1b1b1b; color: #999999; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px; border: 0px;">1<br />2<br />3<br />4<br />5<br />6<br /></pre></td><td style="padding: 0px; vertical-align: middle; border-width: 0px; border-style: initial; border-color: initial;"><pre style="font-family: consolas, Menlo, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;; font-size: 1em; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #cccccc; line-height: 1.6; margin-top: 0px; margin-bottom: 0px; overflow: auto; padding: 10px 0px 10px 10px; border: 0px; width: 773px;">$ ssh -T git@github.com<br />The authenticity of host 'github.com (192.30.253.112)' can't be established.<br />RSA key fingerprint is SHA256:nThbg6kXUpxxxxxxxxARLviKw6E5SY8.<br />Are you sure you want to continue connecting (yes/no)? yes<br />Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.<br />Hi xxxxxx! You've successfully authenticated, but GitHub does not provide shell access.<br /></pre></td></tr></tbody></table></div></figure><div style="cursor: pointer; line-height: 1.6; opacity: 0; padding: 2px 6px; position: absolute; transition-delay: 0s; transition-duration: 0.2s; transition-timing-function: ease-in-out; color: #ffffff; font-size: 14px; right: 0px; top: 2px;"></div></div><hr style="box-sizing: content-box; height: 2px; overflow: visible; background-image: repeating-linear-gradient(-45deg, #dddddd, #dddddd 4px, transparent 4px, transparent 8px); border: 0px; margin: 20px 0px;" /><p style="margin: 0px 0px 20px;">然后就可以将本地的项目用github来管理了。</p><hr style="box-sizing: content-box; height: 2px; overflow: visible; background-image: repeating-linear-gradient(-45deg, #dddddd, #dddddd 4px, transparent 4px, transparent 8px); border: 0px; margin: 20px 0px;" /><h4><a href="https://www.itfanr.cc/2017/03/03/using-ssh-key-connection-github-in-linux/#%E6%9B%B4%E6%96%B0%E6%97%A5%E5%BF%97" title="更新日志" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;"></a>更新日志</h4><ul><li>2017-10-27 - 完善&#8221;连接测试&#8221;内容; 添加Mac系统下安装git配置</li></ul></div><div style="margin: 20px auto; padding-top: 10px; padding-bottom: 10px; text-align: center; width: 810px; color: #555555; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;"><div>如有疑问或需要技术讨论，请留言或发邮件到 service@itfanr.cc</div><button style="font-family: inherit; font-size: 16px; line-height: 2; margin: 0px; overflow: visible; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 1px; border-style: solid; border-color: #fc6423; border-radius: 0px; color: #fc6423; cursor: pointer; outline: 0px; padding: 0px 15px; vertical-align: text-top;">打赏</button></div><div style="color: #555555; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;"><ul style="background: var(--card-bg-color); border-left: 3px solid #ff2a2a; list-style: none; margin: 2em 0px 0px; padding: 0.5em 1em;"><li><span style="font-weight: bolder;">本文作者：&nbsp;</span>Leafney</li><li><span style="font-weight: bolder;">本文链接：</span>&nbsp;<a href="https://www.itfanr.cc/2017/03/03/using-ssh-key-connection-github-in-linux/" title="Linux下使用SSH密钥连接Github" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;">https://www.itfanr.cc/2017/03/03/using-ssh-key-connection-github-in-linux/</a></li><li><span style="font-weight: bolder;">版权声明：&nbsp;</span>本博客所有文章除特别声明外，均采用&nbsp;<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="noopener" target="_blank" style="background: transparent; border-bottom: 1px solid #cccccc; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer;">BY-NC-SA</a>&nbsp;许可协议。转载请注明出处！</li></ul></div><footer style="color: #555555; font-family: Lato, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 16px; background-color: #ffffff;"><div style="margin-top: 40px;"><a href="https://www.itfanr.cc/tags/Linux/" rel="tag" style="background: #f5f5f5; border-bottom: none; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer; display: inline-block; font-size: 0.8125em; margin-right: 10px; padding: 1px 5px;"># Linux</a>&nbsp;<a href="https://www.itfanr.cc/tags/GitHub/" rel="tag" style="background: #f5f5f5; border-bottom: none; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer; display: inline-block; font-size: 0.8125em; margin-right: 10px; padding: 1px 5px;"># GitHub</a>&nbsp;<a href="https://www.itfanr.cc/tags/SSH/" rel="tag" style="background: #f5f5f5; border-bottom: none; outline: 0px; text-decoration-line: none; overflow-wrap: break-word; cursor: pointer; display: inline-block; font-size: 0.8125em; padding: 1px 5px;"># SSH</a></div></footer><img src ="http://www.cppblog.com/markqian86/aggbug/217436.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/markqian86/" target="_blank">长戟十三千</a> 2020-09-03 11:26 <a href="http://www.cppblog.com/markqian86/archive/2020/09/03/217436.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Centos 7 yum升级GCC 8版本</title><link>http://www.cppblog.com/markqian86/archive/2020/04/02/217225.html</link><dc:creator>长戟十三千</dc:creator><author>长戟十三千</author><pubDate>Thu, 02 Apr 2020 07:54:00 GMT</pubDate><guid>http://www.cppblog.com/markqian86/archive/2020/04/02/217225.html</guid><wfw:comment>http://www.cppblog.com/markqian86/comments/217225.html</wfw:comment><comments>http://www.cppblog.com/markqian86/archive/2020/04/02/217225.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/markqian86/comments/commentRss/217225.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/markqian86/services/trackbacks/217225.html</trackback:ping><description><![CDATA[<p style="box-sizing: inherit; margin: 0px 0px 20px; line-height: inherit; color: #333333; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">Centos 7.6 yum升级GCC8版本:</p><p style="box-sizing: inherit; margin: 0px 0px 20px; line-height: inherit; color: #333333; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">1.安装scl源：</p><p style="box-sizing: inherit; margin: 0px 0px 20px; line-height: inherit; color: #333333; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">yum install centos-release-scl scl-utils-build</p><p style="box-sizing: inherit; margin: 0px 0px 20px; line-height: inherit; color: #333333; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;"><img height="679" src="https://oscimg.oschina.net/oscnet/5d52aefe3f19f9773c47c2091bd3cf1a0be.jpg" width="1274" style="margin: 0px auto; height: auto; box-sizing: border-box; border: 0px; vertical-align: middle; cursor: zoom-in; max-width: 80%;"  alt="" /></p><p style="box-sizing: inherit; margin: 0px 0px 20px; line-height: inherit; color: #333333; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">执行：</p><p style="box-sizing: inherit; margin: 0px 0px 20px; line-height: inherit; color: #333333; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">&nbsp;yum load-transaction /tmp/yum_save_tx.2019-03-20.16-33.GsJYkI.yumtx</p><p style="box-sizing: inherit; margin: 0px 0px 20px; line-height: inherit; color: #333333; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;"><img height="688" src="https://oscimg.oschina.net/oscnet/508ef84aa97c7b63a153c098687af20fa0f.jpg" width="1278" style="margin: 0px auto; height: auto; box-sizing: border-box; border: 0px; vertical-align: middle; cursor: zoom-in; max-width: 80%;"  alt="" /></p><p style="box-sizing: inherit; margin: 0px 0px 20px; line-height: inherit; color: #333333; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;"><br style="box-sizing: inherit;" />2.列出scl可用源:</p><p style="box-sizing: inherit; margin: 0px 0px 20px; line-height: inherit; color: #333333; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">yum list all --enablerepo='centos-sclo-rh'</p><p style="box-sizing: inherit; margin: 0px 0px 20px; line-height: inherit; color: #333333; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;"><img height="758" src="https://oscimg.oschina.net/oscnet/fd1507259f7bfe020e457022518f58b1b0f.jpg" width="1278" style="margin: 0px auto; height: auto; box-sizing: border-box; border: 0px; vertical-align: middle; cursor: zoom-in; max-width: 80%;"  alt="" /></p><p style="box-sizing: inherit; margin: 0px 0px 20px; line-height: inherit; color: #333333; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">yum list all --enablerepo='centos-sclo-rh' | grep "devtoolset-"</p><p style="box-sizing: inherit; margin: 0px 0px 20px; line-height: inherit; color: #333333; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;"><img height="762" src="https://oscimg.oschina.net/oscnet/31714e345e106bf2663a5d201a1ef8099bc.jpg" width="1259" style="margin: 0px auto; height: auto; box-sizing: border-box; border: 0px; vertical-align: middle; cursor: zoom-in; max-width: 80%;"  alt="" /></p><p style="box-sizing: inherit; margin: 0px 0px 20px; line-height: inherit; color: #333333; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">&nbsp;</p><p style="box-sizing: inherit; margin: 0px 0px 20px; line-height: inherit; color: #333333; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">3.安装8版本的gcc、gcc-c++、gdb工具链（toolchian）：</p><p style="box-sizing: inherit; margin: 0px 0px 20px; line-height: inherit; color: #333333; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">yum install -y devtoolset-8-toolchain</p><p style="box-sizing: inherit; margin: 0px 0px 20px; line-height: inherit; color: #333333; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">scl enable devtoolset-8 bash</p><p style="box-sizing: inherit; margin: 0px 0px 20px; line-height: inherit; color: #333333; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">gcc --version</p><p style="box-sizing: inherit; margin: 0px; line-height: inherit; color: #333333; font-family: -apple-system, BlinkMacSystemFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;"><img height="618" src="https://oscimg.oschina.net/oscnet/3563170c362ac5eaaee8956715fdf3bd411.jpg" width="1236" style="margin: 0px auto; height: auto; box-sizing: border-box; border: 0px; vertical-align: middle; cursor: zoom-in; max-width: 80%;"  alt="" /></p><img src ="http://www.cppblog.com/markqian86/aggbug/217225.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/markqian86/" target="_blank">长戟十三千</a> 2020-04-02 15:54 <a href="http://www.cppblog.com/markqian86/archive/2020/04/02/217225.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Mac系统VirtualBox中CentOS启用共享文件夹</title><link>http://www.cppblog.com/markqian86/archive/2020/02/16/217131.html</link><dc:creator>长戟十三千</dc:creator><author>长戟十三千</author><pubDate>Sun, 16 Feb 2020 11:51:00 GMT</pubDate><guid>http://www.cppblog.com/markqian86/archive/2020/02/16/217131.html</guid><wfw:comment>http://www.cppblog.com/markqian86/comments/217131.html</wfw:comment><comments>http://www.cppblog.com/markqian86/archive/2020/02/16/217131.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/markqian86/comments/commentRss/217131.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/markqian86/services/trackbacks/217131.html</trackback:ping><description><![CDATA[<div>1. 电脑下载VBoxAdditions，网址：http://download.virtualbox.org/virtualbox/5.1.12/Oracle_VM_VirtualBox_Extension_Pack-5.1.12.vbox-extpack</div><div></div><div>2. 下载完成后双击打开，按照下一步的指示安装完成。</div><div></div><div>3. 电脑下载VBoxAdditions，网址：http://download.virtualbox.org/virtualbox/5.1.12/VBoxGuestAdditions_5.1.12.iso</div><div></div><div>4. CentOS挂上光驱：</div><div></div><div>mkdir /mnt/cdrom</div><div></div><div>mount /dev/cdrom /mnt/cdrom</div><div></div><div>5. 将光驱内的文件夹复制到硬盘中。（如果直接在光驱中执行安装，会因为权限问题导致无法安装。）</div><div></div><div>cp -R /mnt/cdrom /usr/local/src/VBoxAdditions</div><div></div><div>6. （可选）安装前需要设置安装环境，如果已设置，那么这一步可以跳过：</div><div></div><div>yum install gcc</div><div></div><div>yum install make</div><div></div><div>yum install kernel-headers</div><div></div><div>yum install kernel-devel</div><div></div><div>7. 进入文件夹，开始安装：./VBoxLinuxAdditions.run install<br /><br /><span style="color: #4d4d4d; font-family: &quot;Microsoft YaHei&quot;, &quot;SF Pro Display&quot;, Roboto, Noto, Arial, &quot;PingFang SC&quot;, sans-serif; font-size: 16px; background-color: #ffffff;">重启系统!!!!!!!!!!!!!!!!!</span></div><div></div><div><br />8. 启用共享文件夹：</div><div></div><div>mkdir /mnt/share</div><div></div><div>mount -t vboxsf vmshare /mnt/share<br />注释：vmshare为visualbox界面配置里添加的共享文件路径和名称</div><div><span style="color: #4d4d4d; font-family: &quot;Microsoft YaHei&quot;, &quot;SF Pro Display&quot;, Roboto, Noto, Arial, &quot;PingFang SC&quot;, sans-serif; font-size: 16px;">ln -s&nbsp;/mnt/share /home/myshare (软连接到用户myshare下)<br /><br /></span>9. 成功！</div><div>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</div><div>版权声明：本文为CSDN博主「熊小憨」的原创文章，遵循 CC 4.0 BY-SA 版权协议，转载请附上原文出处链接及本声明。</div><div>原文链接：https://blog.csdn.net/suma110/article/details/54343686</div><img src ="http://www.cppblog.com/markqian86/aggbug/217131.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/markqian86/" target="_blank">长戟十三千</a> 2020-02-16 19:51 <a href="http://www.cppblog.com/markqian86/archive/2020/02/16/217131.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>centos7 安装Mariadb</title><link>http://www.cppblog.com/markqian86/archive/2020/02/15/217127.html</link><dc:creator>长戟十三千</dc:creator><author>长戟十三千</author><pubDate>Sat, 15 Feb 2020 03:45:00 GMT</pubDate><guid>http://www.cppblog.com/markqian86/archive/2020/02/15/217127.html</guid><wfw:comment>http://www.cppblog.com/markqian86/comments/217127.html</wfw:comment><comments>http://www.cppblog.com/markqian86/archive/2020/02/15/217127.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/markqian86/comments/commentRss/217127.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/markqian86/services/trackbacks/217127.html</trackback:ping><description><![CDATA[<p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">MariaDB 数据库管理系统是 MySQL 的一个分支，主要由开源社区在维护，采用 GPL 授权许可。开发这个分支的原因之一是：甲骨文公司收购了 MySQL 后，有将 MySQL 闭源的潜在风险，因此社区采用分支的方式来避开这个风险。MariaDB完全兼容mysql，使用方法也是一样的</span></p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">有的centos7已经默认安装了Mariadb，可以查看自己的有没有安装，没有安装的再进行安装，已经安装了可以不用安装也可以卸载了重装。卸载命令 yum remove mariadb-server</span></p><div style="margin: 5px 0px; font-size: 12px !important;"><img id="code_img_closed_64c7d235-90bf-433c-9e89-6511d0cb1f8c" src="https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif" alt="" style="margin: 0px; padding-top: 0px; padding-bottom: 0px; padding-left: 0px; border: 0px; max-width: 680px; height: auto;" />&nbsp;<span style="margin: 0px; line-height: 1.5 !important;">我的系统环境</span></div><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><strong style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px; font-size: 14pt;">1、安装MariaDB</span></strong></p><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">&nbsp;通过yum安装就行了。简单快捷，安装mariadb-server，默认依赖安装mariadb，一个是服务端、一个是客户端。</span></p><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">[root@mini ~]# <span style="margin: 0px; padding: 0px; color: #0000ff; line-height: 1.5 !important;">yum</span> <span style="margin: 0px; padding: 0px; color: #0000ff; line-height: 1.5 !important;">install</span> mariadb-server</pre></div><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><strong style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px; font-size: 14pt;">2、配置MariaDB</span></strong></p><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">1）安装完成后首先要把MariaDB服务开启，并设置为开机启动</span></p><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">[root@mini ~<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">]# systemctl start mariadb  # 开启服务 [root@mini </span>~]# systemctl enable mariadb  # 设置为开机自启动服务</pre></div><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">2）首次安装需要进行数据库的配置，命令都和mysql的一样</span></p><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">[root@mini ~]# mysql_secure_installation</pre></div><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">&nbsp;3）配置时出现的各个选项</span></p><div style="margin: 5px 0px; font-size: 12px !important;"><div style="margin: 5px 0px 0px;"><span style="margin: 0px; padding: 0px 5px 0px 0px; line-height: 1.5 !important;"><a title="复制代码" style="margin: 0px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; font-size: 14px; text-decoration-line: underline; line-height: normal; border: none !important;"><img src="https://common.cnblogs.com/images/copycode.gif" alt="复制代码" style="margin: 0px; padding: 0px; max-width: 680px; height: auto; border: none !important;" /></a></span></div><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">Enter current password <span style="margin: 0px; padding: 0px; color: #0000ff; line-height: 1.5 !important;">for</span> root (enter <span style="margin: 0px; padding: 0px; color: #0000ff; line-height: 1.5 !important;">for</span><span style="margin: 0px; padding: 0px; line-height: 1.5 !important;"> none):  # 输入数据库超级管理员root的密码(注意不是系统root的密码)，第一次进入还没有设置密码则直接回车  Set root password</span>? [Y/<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">n]  # 设置密码，y  New password:  # 新密码 Re</span>-<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">enter new password:  # 再次输入密码  Remove anonymous users</span>? [Y/<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">n]  # 移除匿名用户， y  Disallow root </span><span style="margin: 0px; padding: 0px; color: #0000ff; line-height: 1.5 !important;">login</span> remotely? [Y/<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">n]  # 拒绝root远程登录，n，不管y/n，都会拒绝root远程登录  Remove test database and access to it</span>? [Y/<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">n]  # 删除test数据库，y：删除。n：不删除，数据库中会有一个test数据库，一般不需要  Reload privilege tables now</span>? [Y/n]  # 重新加载权限表，y。或者重启服务也许</pre><div style="margin: 5px 0px 0px;"><span style="margin: 0px; padding: 0px 5px 0px 0px; line-height: 1.5 !important;"><a title="复制代码" style="margin: 0px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; font-size: 14px; text-decoration-line: underline; line-height: normal; border: none !important;"><img src="https://common.cnblogs.com/images/copycode.gif" alt="复制代码" style="margin: 0px; padding: 0px; max-width: 680px; height: auto; border: none !important;" /></a></span></div></div><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">4）测试是否能够登录成功，出现&nbsp; MariaDB [(none)]&gt; 就表示已经能够正常登录使用MariaDB数据库了</span></p><div style="margin: 5px 0px; font-size: 12px !important;"><div style="margin: 5px 0px 0px;"><span style="margin: 0px; padding: 0px 5px 0px 0px; line-height: 1.5 !important;"><a title="复制代码" style="margin: 0px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; font-size: 14px; text-decoration-line: underline; line-height: normal; border: none !important;"><img src="https://common.cnblogs.com/images/copycode.gif" alt="复制代码" style="margin: 0px; padding: 0px; max-width: 680px; height: auto; border: none !important;" /></a></span></div><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">[root@mini ~]# mysql -u root -<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">p Enter password: Welcome to the MariaDB monitor.  Commands end with ; or \g. Your MariaDB connection </span><span style="margin: 0px; padding: 0px; color: #0000ff; line-height: 1.5 !important;">id</span> is <span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">8</span><span style="margin: 0px; padding: 0px; line-height: 1.5 !important;"> Server version: </span><span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">5.5</span>.<span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">60</span>-<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">MariaDB MariaDB Server  Copyright (c) </span><span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">2000</span>, <span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">2018</span><span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">, Oracle, MariaDB Corporation Ab and others.  Type </span><span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">'</span><span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">help;</span><span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">'</span> or <span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">'</span><span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">\h</span><span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">'</span> <span style="margin: 0px; padding: 0px; color: #0000ff; line-height: 1.5 !important;">for</span> help. Type <span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">'</span><span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">\c</span><span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">'</span> to <span style="margin: 0px; padding: 0px; color: #0000ff; line-height: 1.5 !important;">clear</span><span style="margin: 0px; padding: 0px; line-height: 1.5 !important;"> the current input statement.  MariaDB [(none)]</span>&gt;</pre><div style="margin: 5px 0px 0px;"><span style="margin: 0px; padding: 0px 5px 0px 0px; line-height: 1.5 !important;"><a title="复制代码" style="margin: 0px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; font-size: 14px; text-decoration-line: underline; line-height: normal; border: none !important;"><img src="https://common.cnblogs.com/images/copycode.gif" alt="复制代码" style="margin: 0px; padding: 0px; max-width: 680px; height: auto; border: none !important;" /></a></span></div></div><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><strong style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px; font-size: 14pt;">3、设置MariaDB字符集为utf-8</span></strong></p><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;">&nbsp;<span style="margin: 0px; padding: 0px; font-size: 16px;">1）/etc/my.cnf 文件</span></p><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">在&nbsp; [mysqld]&nbsp; 标签下添加</span></p><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">init_connect=<span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">'</span><span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">SET collation_connection = utf8_unicode_ci</span><span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">'</span><span style="margin: 0px; padding: 0px; line-height: 1.5 !important;"> init_connect</span>=<span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">'</span><span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">SET NAMES utf8</span><span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">'</span><span style="margin: 0px; padding: 0px; line-height: 1.5 !important;"> character</span>-set-server=<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">utf8 collation</span>-server=<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">utf8_unicode_ci skip</span>-character-set-client-handshake</pre></div><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">2）/etc/my.cnf.d/client.cnf 文件</span></p><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">在&nbsp; [client]&nbsp; 标签下添加</span></p><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">default-character-set=utf8</pre></div><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">3）/etc/my.cnf.d/mysql-clients.cnf&nbsp; 文件</span></p><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">在&nbsp; [mysql]&nbsp; 标签下添加</span></p><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">default-character-set=utf8</pre></div><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">4）重启服务</span></p><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">[root@mini ~]# systemctl restart mariadb</pre></div><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">5）进入mariadb查看字符集</span></p><div style="margin: 5px 0px; font-size: 12px !important;"><img id="code_img_closed_d57eadf2-f105-43af-ad2e-8b1efc646000" src="https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif" alt="" style="margin: 0px; padding-top: 0px; padding-bottom: 0px; padding-left: 0px; border: 0px; max-width: 680px; height: auto;" />&nbsp;<span style="margin: 0px; line-height: 1.5 !important;">未配置字符集前</span></div><div style="margin: 5px 0px; font-size: 12px !important;"><img id="code_img_closed_79db56bb-e735-4aa4-919e-773971df70e7" src="https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif" alt="" style="margin: 0px; padding-top: 0px; padding-bottom: 0px; padding-left: 0px; border: 0px; max-width: 680px; height: auto;" />&nbsp;<span style="margin: 0px; line-height: 1.5 !important;">配置字符集后</span></div><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><strong style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px; font-size: 14pt;">4、远程链接mariadb数据库</span></strong></p><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">mariadb默认是拒绝 root 远程登录的。这里用的是 navicat 软件连接数据库</span></p><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">1）关闭防火墙</span></p><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">&#9312; 关闭防火墙&nbsp;systemctl stop firewalld&nbsp;</span></p><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">[root@mini ~]# systemctl stop firewalld</pre></div><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">&#9313; 在不关闭防火墙的情况下，允许某端口的外来链接。步骤如下，开启3306端口，重启防火墙</span></p><div style="margin: 5px 0px; font-size: 12px !important;"><div style="margin: 5px 0px 0px;"><span style="margin: 0px; padding: 0px 5px 0px 0px; line-height: 1.5 !important;"><a title="复制代码" style="margin: 0px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; font-size: 14px; text-decoration-line: underline; line-height: normal; border: none !important;"><img src="https://common.cnblogs.com/images/copycode.gif" alt="复制代码" style="margin: 0px; padding: 0px; max-width: 680px; height: auto; border: none !important;" /></a></span></div><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">[root@mini ~]# firewall-cmd --query-port=<span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">3306</span>/<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">tcp  # 查看3306端口是否开启 no [root@mini </span>~]# firewall-cmd --zone=public --add-port=<span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">3306</span>/tcp --<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">permanent  # 开启3306端口 success [root@mini </span>~]# firewall-cmd --<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">reload  # 重启防火墙 success [root@mini </span>~]# firewall-cmd --query-port=<span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">3306</span>/<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">tcp  # 查看3306端口是否开启 yes</span></pre><div style="margin: 5px 0px 0px;"><span style="margin: 0px; padding: 0px 5px 0px 0px; line-height: 1.5 !important;"><a title="复制代码" style="margin: 0px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; font-size: 14px; text-decoration-line: underline; line-height: normal; border: none !important;"><img src="https://common.cnblogs.com/images/copycode.gif" alt="复制代码" style="margin: 0px; padding: 0px; max-width: 680px; height: auto; border: none !important;" /></a></span></div></div><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">2）先查看mysql数据库中的user表</span></p><div style="margin: 5px 0px; font-size: 12px !important;"><div style="margin: 5px 0px 0px;"><span style="margin: 0px; padding: 0px 5px 0px 0px; line-height: 1.5 !important;"><a title="复制代码" style="margin: 0px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; font-size: 14px; text-decoration-line: underline; line-height: normal; border: none !important;"><img src="https://common.cnblogs.com/images/copycode.gif" alt="复制代码" style="margin: 0px; padding: 0px; max-width: 680px; height: auto; border: none !important;" /></a></span></div><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">[root@mini ~]# mysql -u root -<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">p  # 先通过本地链接进入数据库  MariaDB [(none)]</span>&gt;<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;"> use mysql;  MariaDB [mysql]</span>&gt; <span style="margin: 0px; padding: 0px; color: #0000ff; line-height: 1.5 !important;">select</span><span style="margin: 0px; padding: 0px; line-height: 1.5 !important;"> host, user from user; </span>+-----------+------+ | host      | user | +-----------+------+ | <span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">127.0</span>.<span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">0.1</span> | root | | ::<span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">1</span>       | root | | mini      | root | +-----------+------+ <span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">3</span> rows <span style="margin: 0px; padding: 0px; color: #0000ff; line-height: 1.5 !important;">in</span> set (<span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">0.00</span> sec)</pre><div style="margin: 5px 0px 0px;"><span style="margin: 0px; padding: 0px 5px 0px 0px; line-height: 1.5 !important;"><a title="复制代码" style="margin: 0px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; font-size: 14px; text-decoration-line: underline; line-height: normal; border: none !important;"><img src="https://common.cnblogs.com/images/copycode.gif" alt="复制代码" style="margin: 0px; padding: 0px; max-width: 680px; height: auto; border: none !important;" /></a></span></div></div><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">3）将与主机名相等的字段改为 "%" ，我的主机名为mini，</span></p><div style="margin: 5px 0px; font-size: 12px !important;"><div style="margin: 5px 0px 0px;"><span style="margin: 0px; padding: 0px 5px 0px 0px; line-height: 1.5 !important;"><a title="复制代码" style="margin: 0px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; font-size: 14px; text-decoration-line: underline; line-height: normal; border: none !important;"><img src="https://common.cnblogs.com/images/copycode.gif" alt="复制代码" style="margin: 0px; padding: 0px; max-width: 680px; height: auto; border: none !important;" /></a></span></div><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">MariaDB [mysql]&gt; update user set host=<span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">'</span><span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">%</span><span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">'</span> where host=<span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">'</span><span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">mini</span><span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">'</span><span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">; Query OK, </span><span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">1</span> row affected (<span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">0.00</span><span style="margin: 0px; padding: 0px; line-height: 1.5 !important;"> sec) Rows matched: </span><span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">1</span>  Changed: <span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">1</span>  Warnings: <span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">0</span><span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">  MariaDB [mysql]</span>&gt; <span style="margin: 0px; padding: 0px; color: #0000ff; line-height: 1.5 !important;">select</span><span style="margin: 0px; padding: 0px; line-height: 1.5 !important;"> host, user from user; </span>+-----------+------+ | host      | user | +-----------+------+ | %         | root | | <span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">127.0</span>.<span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">0.1</span> | root | | localhost | root | +-----------+------+ <span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">3</span> rows <span style="margin: 0px; padding: 0px; color: #0000ff; line-height: 1.5 !important;">in</span> set (<span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">0.00</span> sec)</pre><div style="margin: 5px 0px 0px;"><span style="margin: 0px; padding: 0px 5px 0px 0px; line-height: 1.5 !important;"><a title="复制代码" style="margin: 0px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; font-size: 14px; text-decoration-line: underline; line-height: normal; border: none !important;"><img src="https://common.cnblogs.com/images/copycode.gif" alt="复制代码" style="margin: 0px; padding: 0px; max-width: 680px; height: auto; border: none !important;" /></a></span></div></div><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">4）刷新权限表，或重启mariadb服务，一下二选一即可</span></p><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">MariaDB [mysql]&gt;<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;"> flush privileges; Query OK, </span><span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">0</span> rows affected (<span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">0.00</span> sec)</pre></div><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">[root@mini ~]# systemctl restart mariadb</pre></div><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">注意：刷新权限表是在数据库中，重启服务是在外部命令行中</span></p><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;"><span style="margin: 0px; padding: 0px; font-size: 16px;">6）重新远程链接mariadb</span></p><p style="margin-top: 10px; margin-bottom: 10px; margin-left: 30px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif;">&nbsp;<img src="https://img2018.cnblogs.com/blog/960580/201810/960580-20181013185600440-18039039.png" alt="" style="margin: 0px; padding: 0px; border: 0px; max-width: 680px; height: auto;" /></p><img src ="http://www.cppblog.com/markqian86/aggbug/217127.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/markqian86/" target="_blank">长戟十三千</a> 2020-02-15 11:45 <a href="http://www.cppblog.com/markqian86/archive/2020/02/15/217127.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>