获取所有属性 name classjava.lang.String idclassjava.lang.Integer classclassjava.lang.Class ageclassjava.lang.Integer 根据属性获取这个属性的值 nameTimHo id 1 classclasscom.hewentian.User age 23
System.setProperty("solr.solr.home", "/home/hewentian/ProjectD/solr-6.5.0/server/solr"); CoreContainer coreContainer = new CoreContainer("/home/hewentian/ProjectD/solr-6.5.0/server/solr"); coreContainer.load(); // don't forge to invoke this method since solr 4.4.0 EmbeddedSolrServer embeddedSolrServer = new EmbeddedSolrServer(coreContainer, coreName);
强制、阻止和可选查询: 1)Mandatory:查询结果中必须包括的(for example, only entry name containing the word make) Solr/Lucene Statement:+make, +make +up ,+make +up +kiss 2)prohibited:(for example, all documents except those with word believe) Solr/Lucene Statement:+make +up -kiss 3)optional:Solr/Lucene Statement:+make +up kiss
布尔操作:AND、OR和NOT布尔操作(必须大写)与Mandatory、optional和prohibited相似。 1)make AND up = +make +up :AND左右两边的操作都是mandatory 2)make || up = make OR up=make up :OR左右两边的操作都是optional 3)+make +up NOT kiss = +make +up –kiss 4)make AND up OR french AND Kiss不可以达到期望的结果,因为AND两边的操作都是mandatory的。
子表达式查询(子查询):可以使用“()”构造子查询。 示例:(make AND up) OR (french AND Kiss)
范围查询(Range Query):Lucene支持对数字、日期甚至文本的范围查询。结束的范围可以使用“*”通配符。 示例: 1)日期范围(ISO-8601 时间GMT):sa_type:2 AND a_begin_date:[1990-01-01T00:00:00.000Z TO 1999-12-31T24:59:99.999Z] 2)数字:salary:[2000 TO *] 3)文本:entryNm:[a TO a]
日期匹配:YEAR, MONTH, DAY, DATE (synonymous with DAY) HOUR, MINUTE, SECOND, MILLISECOND, and MILLI (synonymous with MILLISECOND)可以被标志成日期。 示例: 1)r_event_date:[* TO NOW-2YEAR]:2年前的现在这个时间 2)r_event_date:[* TO NOW/DAY-2YEAR]:2年前前一天的这个时间
solr的查询语句支持C语言格式的注释。 "jakarta apache" /* this is a comment in the middle of a normal query string */ OR jakarta
查询语句: chief AND officer 这将会匹配所有可能的用例,但是同时也会匹配所有包含了这两个关键字的文档。例如:One chief concern arising from the incident was the safety of the police officer on duty。这个文档明显不符合我们的要求,但是如果使用上面的查询语句,那么将会返回这个文档。
<!-- The default high-performance update handler --> <updateHandlerclass="solr.DirectUpdateHandler2">
<!-- Enables a transaction log, used for real-time get, durability, and and solr cloud replica recovery. The log can grow as big as uncommitted changes to the index, so use of a hard autoCommit is recommended (see below). "dir" - the target directory for transaction logs, defaults to the solr data directory. "numVersionBuckets" - sets the number of buckets used to keep track of max version values when checking for re-ordered updates; increase this value to reduce the cost of synchronizing access to version buckets during high-volume indexing, this requires 8 bytes (long) * numVersionBuckets of heap space per Solr core. --> <updateLog> <strname="dir">${solr.ulog.dir:}</str> <intname="numVersionBuckets">${solr.ulog.numVersionBuckets:65536}</int> </updateLog>
<!-- AutoCommit Perform a hard commit automatically under certain conditions. Instead of enabling autoCommit, consider using "commitWithin" when adding documents. http://wiki.apache.org/solr/UpdateXmlMessages maxDocs - Maximum number of documents to add since the last commit before automatically triggering a new commit. maxTime - Maximum amount of time in ms that is allowed to pass since a document was added before automatically triggering a new commit. openSearcher - if false, the commit causes recent index changes to be flushed to stable storage, but does not cause a new searcher to be opened to make those changes visible. If the updateLog is enabled, then it's highly recommended to have some sort of hard autoCommit to limit the log size. --> <autoCommit> <maxTime>${solr.autoCommit.maxTime:15000}</maxTime> <openSearcher>false</openSearcher> </autoCommit>
<!-- softAutoCommit is like autoCommit except it causes a 'soft' commit which only ensures that changes are visible but does not ensure that data is synced to disk. This is faster and more near-realtime friendly than a hard commit. -->
<!-- Update Related Event Listeners Various IndexWriter related events can trigger Listeners to take actions. postCommit - fired after every commit or optimize command postOptimize - fired after every optimize command --> <!-- The RunExecutableListener executes an external command from a hook such as postCommit or postOptimize. exe - the name of the executable to run dir - dir to use as the current working directory. (default=".") wait - the calling thread waits until the executable returns. (default="true") args - the arguments to pass to the program. (default is none) env - environment variables to set. (default is none) --> <!-- This example shows how RunExecutableListener could be used with the script based replication... http://wiki.apache.org/solr/CollectionDistribution --> <!-- <listener event="postCommit" class="solr.RunExecutableListener"> <str name="exe">solr/bin/snapshooter</str> <str name="dir">.</str> <bool name="wait">true</bool> <arr name="args"> <str>arg1</str> <str>arg2</str> </arr> <arr name="env"> <str>MYVAR=val1</str> </arr> </listener> -->
# cd /home/hewentian/ProjectD $ tar xzvf solr-6.5.0.tgz
我解压到/home/hewentian/ProjectD/solr-6.5.0,目录结构如下: bin contrib dist docs example licenses server CHANGES.txt LICENSE.txt LUCENE_CHANGES.txt NOTICE.txt README.txt
<dataConfig> <dataSourcename="ds"type="JdbcDataSource"driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/test"user="root"password="root" /> <document> <entityname="user"pk="id"dataSource="ds"query="select * from user" deltaQuery="select id from user where update_time_>'${dataimporter.last_index_time}'" deltaImportQuery="select t.* from user t where t.id='${dataimporter.delta.id}'"> <fieldname="id"column="id" /> <fieldname="name"column="name_" /> <fieldname="age"column="age_" /> <fieldname="ability"column="ability_" /> <fieldname="address"column="address_" />
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
>
> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
> id sem consectetuer libero luctus adipiscing.
Example as below:
This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
blockquote 还可以 nested 其他 blockquote
> This is the first level of quoting.
>
> > This is nested blockquote.
>
> Back to the first level.
Example as below:
This is the first level of quoting.
This is nested blockquote.
Back to the first level.
3. List
列表分为有序和无序
3.1 无序列表写法如下:
* Red
* Green
* Blue
Example as below:
Red
Green
Blue
3.2 有序列表写法如下:
1. Red
2. Green
3. Blue
Example as below:
Red
Green
Blue
其中的序号,不影响它的效果,你也可以像下面这样写,它的效果是一样的。
1. Red
1. Green
1. Blue
或
1. Red
6. Green
8. Blue
List items may consist of multiple paragraphs. Each subsequent paragraph in a list item must be indented by either 4 spaces or one tab:
1. This is a list item with two paragraphs. Lorem ipsum dolor
sit amet, consectetuer adipiscing elit. Aliquam hendrerit
mi posuere lectus.
Vestibulum enim wisi, viverra nec, fringilla in, laoreet
vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
sit amet velit.
2. Suspendisse id sem consectetuer libero luctus adipiscing.
Example as below:
This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
Suspendisse id sem consectetuer libero luctus adipiscing.
To put a code block within a list item, the code block needs to be indented twice – 8 spaces or two tabs:
* A list item with a code block:
<code goes here>
Example as below:
A list item with a code block:
printf("hello world")
4. CODE BLOCKS
To produce a code block in Markdown, simply indent every line of the block by at least 4 spaces or 1 tab. For example, given this input:
This is a normal paragraph:
This is a code block.
Example as below: This is a normal paragraph:
This is a code block.
5. HORIZONTAL RULES
产生水平分割线的方法有以下几种,它们的效果都是一样的
* * *
***
******
- - -
------
6. LINKS
This is [an example](http://example.com/ "Title") inline link.
[This link](http://example.net/) has no title attribute.
你还可以这样写 links Reference-style links use a second set of square brackets, inside which you place a label of your choosing to identify the link:
This is [an example][id] reference-style link.
Then, anywhere in the document, you define your link label like this, on a line by itself:
[id]: http://example.com/ "Optional Title Here"
Example as below: This is an example reference-style link.
Link definition names may consist of letters, numbers, spaces, and punctuation — but they are not case sensitive. E.g. these two links:
[link text][a]
[link text][A]
are equivalent.
The implicit link name shortcut allows you to omit the name of the link, in which case the link text itself is used as the name. Just use an empty set of square brackets — e.g., to link the word “Google” to the google.com web site, you could simply write:
[Google][]
And then define the link:
[Google]: http://google.com/
Example as below: In china, you can’t use Google, hahaha…
7. EMPHASIS
Markdown treats asterisks (*) and underscores (_) as indicators of emphasis. Text wrapped with one * or _ will be wrapped with an HTML<em>tag; double *’s or _’s will be wrapped with an HTML<strong>tag. E.g., this input:
Example as below: single asterisks single underscores double asterisks double underscores
To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it:
\*this text is surrounded by literal asterisks\*
8. CODE
To indicate a span of code, wrap it with backtick quotes (`). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:
Use the `printf()` function.
will produce:
<p>Use the <code>printf()</code> function.</p>
Example as below: Use the printf() function.
To include a literal backtick character within a code span, you can use multiple backticks as the opening and closing delimiters:
``There is a literal backtick (`) here.``
which will produce this:
<p><code>There is a literal backtick (`) here.</code></p>
Example as below: There is a literal backtick (`) here.
Where “id” is the name of a defined image reference. Image references are defined using syntax identical to link references:
[id]: url/to/image "Optional title attribute"
10. MISCELLANEOUS
AUTOMATIC LINKS
Markdown supports a shortcut style for creating “automatic” links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:
Markdown allows you to use backslash escapes to generate literal characters which would otherwise have special meaning in Markdown’s formatting syntax. For example, if you wanted to surround a word with literal asterisks (instead of an HTML tag), you can use backslashes before the asterisks, like this:
\*literal asterisks\*
Markdown provides backslash escapes for the following characters:
\ backslash
` backtick
* asterisk
_ underscore
{} curly braces
[] square brackets
() parentheses
# hash mark
+ plus sign
- minus sign (hyphen)
. dot
! exclamation mark
创建表格语法如下:
| Tables | Are | Cool |
| ------------- |:-------------:| -----:|
| col 3 is | right-aligned | $1600 |
| col 2 is | centered | $12 |
| zebra stripes | are neat | $1 |
在window -> Preferences -> general -> keys中, 找到 content asist 修改下边值 Binding 改成 Alt+/ 输入的时候要注意,长按Alt键,然后按下/键即可 When 改为 Editing Text ok.
ubuntu 使用switchHosts修改host后启动eclipse项目报错
1 2 3 4
错误: 抛出异常错误: `java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: localhost: hewentian-Lenovo-IdeaPad-Y470`: 未知的名称或服务 Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: localhost: hewentian-Lenovo-IdeaPad-Y470: Name or service not known
$ netstat -apn | grep 8761 (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) tcp6 0 0 :::8761 :::* LISTEN 24831/java tcp6 0 0 127.0.0.1:49958 127.0.0.1:8761 ESTABLISHED 24824/java tcp6 0 0 127.0.0.1:50494 127.0.0.1:8761 TIME_WAIT - tcp6 0 0 127.0.0.1:50502 127.0.0.1:8761 TIME_WAIT - tcp6 0 0 127.0.0.1:50484 127.0.0.1:8761 TIME_WAIT - tcp6 0 0 127.0.0.1:8761 127.0.0.1:49958 ESTABLISHED 24831/java unix 3 [ ] STREAM CONNECTED 2887618 21883/chrome unix 3 [ ] STREAM CONNECTED 2887619 22047/chrome --type
telnet localhost <port> // On the server, try to see if the port is open there
telnet <server> <port> // On the client, try to see if the port is accessible remotely
示例:
1 2 3 4 5
$ telnet 192.168.8.112 8088
Trying 192.168.8.112... Connected to 192.168.8.112. Escape character is '^]'.
方法二:使用nc
1 2
$ nc -v 192.168.8.112 8088 Connection to 192.168.8.112 8088 port [tcp/omniorb] succeeded!
The program 'rar' is currently not installed. You can install it by typing: sudo apt install rar
如果输出如上面,则Linux中未安装rar命令,按提示安装即可
1 2 3 4 5 6 7 8 9 10
$ sudo apt install rar [sudo] password for hewentian: Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: unrar The following NEW packages will be installed: rar 0 upgraded, 1 newly installed, 0 to remove and 142 no
等待安装完成即可,验证是否成功安装,输入rar即可,看到如下输出,即证明安装成功。
1 2 3 4 5 6 7 8 9 10 11 12 13 14
$ rar
RAR 5.30 beta 2 Copyright (c) 1993-2015 Alexander Roshal 4 Aug 2015 Trial version Type RAR -? forhelp
Autoselected keyboard map en-us ERROR: CredSSP: Initialize failed, do you have correct kerberos tgt initialized ? Failed to connect, CredSSP required by server.
# /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the `crontab' # command to install the new version when you edit this file # and files in /etc/cron.d. These files also have username fields, # that none of the other crontabs do.
############################################################ # desc: backup important data. every saturday 23:50 run, and the cron is: # 50 23 * * 6 /bin/sh /home/hewentian/backupData.sh >> /home/hewentian/backupData.log 2>&1 # author: Tim Ho # mail: wentian.he@qq.com # created time: 2019-07-24 10:22:28 AM ############################################################
#!/bin/sh
# create the base backup dir, if not exists backupBaseDir=/home/hewentian/backupData/ if [ ! -d "$backupBaseDir" ]; then mkdir -p "$backupBaseDir" fi
# create current backup dir, if not exists backupDir=$backupBaseDir`date +%Y%m%d`"/" if [ ! -d "$backupDir" ]; then mkdir "$backupDir" fi
# begin to backup data echo"-------------------- begin to backup data $(date) --------------------"
echo"start to backup userInfo, about 0.30G" mongoexport -h 192.168.1.100 --port 27017 -u mongo_account -p mongo_account --authenticationDatabase mongo_account -d mongo_account -c userInfo -o "$backupDir"userInfo.json echo -e "end to backup userInfo $(date)\n"
echo"start to backup carInfo, about 0.18G" mongoexport -h 192.168.1.100 --port 27017 -u mongo_account -p mongo_account --authenticationDatabase mongo_account -d mongo_account -c carInfo -o "$backupDir"carInfo.json echo -e "end to backup carInfo $(date)\n"
# at last, delete the files backup 7 days ago find "$backupBaseDir" -type d -mtime +7 -exec rm -rf {} \; #find "$backupBaseDir" -mtime +7 -name '*.json' -exec rm -rf {} \;
echo"-------------------- end to backup data $(date) --------------------"
Ubuntu中访问共享文件夹和FTP
访问共享文件夹:在资源浏览器[Connect to Server]窗口输入:smb://需要访问的机器IP,等同于Windows下输入:\IP
访问FTP机器:在资源浏览器[Connect to Server]窗口输入:ftp://192.168.1.128/
[Connect to Server]在~/.config/nautilus/servers中,可以编辑它的bookmark
sudo netfilter-persistent save
sudo netfilter-persistent reload
完成上述操作就可以永久打开我们需要的端口了
redHat 开放指定端口
同样的,我们开放4412这个端口。先检查iptables是否启动:
sudo service iptables status
Redirecting to /bin/systemctl status iptables.service
Unit iptables.service could not be found.
安装iptables-services:
sudo yum install iptables-services
启动iptables:
sudo service iptables start
编辑配置文件,将4412端口添加到22端口下:
sudo vi /etc/sysconfig/iptables
# sample configuration for iptables service
# you can edit this manually or use system-config-firewall
# please do not ask us to add additional ports/services to this default configuration
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 4412 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
重启:
sudo service iptables restart
查看开放端口:
sudo iptables -nL
Linux下打开ISO文件方法
Linux下用mount挂载命令
1
$ mount -o loop /home/hewentian/Downloads/ubuntu.iso /mnt/cdrom
model name : Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz model name : Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz model name : Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz model name : Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz physical id : 0 physical id : 0 physical id : 0 physical id : 0
linux 查询 内存大小
1 2 3
$ cat /proc/meminfo | grep MemTotal
MemTotal: 8115068 kB
linux 查询 硬盘大小
1 2 3 4 5 6 7 8
$ fdisk -l | grep Disk
Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 sectors Disklabel type: dos Disk identifier: 0x07462b5e Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 sectors Disklabel type: dos Disk identifier: 0x547aca8b
查看内存使用量和交换区使用量
1 2 3 4
$ free -m total used free shared buff/cache available Mem: 7924 5783 472 331 1668 1460 Swap: 15623 1176 14447
$ gpg --gen-key gpg (GnuPG) 1.4.20; Copyright (C) 2015 Free Software Foundation, Inc. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
Please select what kind of key you want: (1) RSA and RSA (default) (2) DSA and Elgamal (3) DSA (sign only) (4) RSA (sign only) Your selection? RSA keys may be between 1024 and 4096 bits long. What keysize do you want? (2048) Requested keysize is 2048 bits Please specify how long the key should be valid. 0 = key does not expire <n> = key expires in n days <n>w = key expires in n weeks <n>m = key expires in n months <n>y = key expires in n years Key is valid for? (0) Key does not expire at all Is this correct? (y/N) y
You need a user ID to identify your key; the software constructs the user ID from the Real Name, Comment and Email Address in this form: "Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>"
Real name: Tim Ho Email address: wentian.he@qq.com Comment: You selected this USER-ID: "Tim Ho <wentian.he@qq.com>"
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O You need a Passphrase to protect your secret key.
We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy. .........+++++ +++++ We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy. +++++
Not enough random bytes available. Please do some other work to give the OS a chance to collect more entropy! (Need 73 more bytes) +++++ gpg: key 46DC4BA0 marked as ultimately trusted public and secret key created and signed.
$ gpg --edit-key 6026DFCA gpg (GnuPG) 1.4.20; Copyright (C) 2015 Free Software Foundation, Inc. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
pub 4096R/6026DFCA created: 2016-05-17 expires: never usage: SC trust: full validity: unknown sub 4096R/12EBCE19 created: 2016-05-17 expires: never usage: E [ unknown] (1). RabbitMQ Release Signing Key <info@rabbitmq.com>
gpg> trust pub 4096R/6026DFCA created: 2016-05-17 expires: never usage: SC trust: full validity: unknown sub 4096R/12EBCE19 created: 2016-05-17 expires: never usage: E [ unknown] (1). RabbitMQ Release Signing Key <info@rabbitmq.com>
Please decide how far you trust this user to correctly verify other users' keys (by looking at passports, checking fingerprints from different sources, etc.) 1 = I don't know or won't say 2 = I do NOT trust 3 = I trust marginally 4 = I trust fully 5 = I trust ultimately m = back to the main menu Your decision? 4 pub 4096R/6026DFCA created: 2016-05-17 expires: never usage: SC trust: full validity: unknown sub 4096R/12EBCE19 created: 2016-05-17 expires: never usage: E [ unknown] (1). RabbitMQ Release Signing Key <info@rabbitmq.com> gpg> sign pub 4096R/6026DFCA created: 2016-05-17 expires: never usage: SC trust: full validity: unknown Primary key fingerprint: 0A9A F211 5F46 87BD 2980 3A20 6B73 A36E 6026 DFCA RabbitMQ Release Signing Key <info@rabbitmq.com> Are you sure that you want to sign this key with your key "Tim Ho <wentian.he@qq.com>" (E99DCF91) Really sign? (y/N) y You need a passphrase to unlock the secret key for user: "Tim Ho <wentian.he@qq.com>" 2048-bit RSA key, ID E99DCF91, created 2018-01-14 gpg> save
$ gpg --list-keys /home/hewentian/.gnupg/pubring.gpg ---------------------------------- pub 2048R/E99DCF91 2018-01-14 uid Tim Ho <wentian.he@qq.com> sub 2048R/6F7627AD 2018-01-14
pub 2048R/46DC4BA0 2018-01-14 uid Tim Ho <wentian.he@qq.com> sub 2048R/74EB06EB 2018-01-14
最后:验证文件的真实性/完整性
1 2 3 4 5 6 7 8 9
$ gpg --verify rabbitmq-server_3.7.2-1_all.deb.asc rabbitmq-server_3.7.2-1_all.deb gpg: Signature made Sat 23 Dec 2017 03:03:34 PM CST using RSA key ID 6026DFCA gpg: checking the trustdb gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model gpg: depth: 0 valid: 2 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 2u gpg: Good signature from "RabbitMQ Release Signing Key <info@rabbitmq.com>" gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: 0A9A F211 5F46 87BD 2980 3A20 6B73 A36E 6026 DFCA
该命令的输出里面含有“Good signature from ”,这表明已下载的.deb文件已成功通过了验证。要是已下载文件在签名生成后以任何一种方式而遭到篡改,验证就会失败。
From the above output we can conclude that the current system has NVIDIA graphic card installed and the recommend driver to install is nvidia-driver-390.
If you agree with the recommendation feel free to use ubuntu-drivers command again to install all recommended drivers:
$ sudo ubuntu-drivers autoinstall
Alternatively, install desired driver selectively using the apt command. For example:
$ sudo apt install nvidia-driver-390
Once the installation is concluded, reboot your system and you are done.
Retrieving speedtest.net configuration... Testing from China Unicom Guangdong province (58.249.3.236)... Retrieving speedtest.net server list... Selecting best server based on ping... Hosted by ChinaTelecom-GZ (Guangzhou) [2.51 km]: 20.736 ms Testing download speed................................................................................ Download: 8.25 Mbit/s Testing upload speed................................................................................................ Upload: 9.03 Mbit/s
INFO: loading config from shadowsocks.json 2019-05-10 09:31:46 INFO loading libcrypto from libcrypto.so.1.1 2019-05-10 09:31:46 INFO starting local at 127.0.0.1:1080
最后,还要在电脑中配置代理,如下图:
这样,就可以正常访问Google了。
修改ubuntu 18.04的sources.list源为阿里
有时候,我们安装软件,会遇到找不到可用的安装包的情况,如下所示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
$ cc
Command 'cc' not found, but can be installed with:
E: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/g/gcc-8/libmpx2_8.2.0-1ubuntu2~18.04_amd64.deb 404 Not Found [IP: 91.189.91.23 80] E: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/g/gcc-8/libquadmath0_8.2.0-1ubuntu2~18.04_amd64.deb 404 Not Found [IP: 91.189.91.23 80] E: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/g/gcc-7/libgcc-7-dev_7.3.0-27ubuntu1~18.04_amd64.deb 404 Not Found [IP: 91.189.91.23 80] E: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/g/gcc-7/gcc-7_7.3.0-27ubuntu1~18.04_amd64.deb 404 Not Found [IP: 91.189.91.23 80] E: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/g/gcc-defaults/gcc_7.3.0-3ubuntu2.1_amd64.deb 404 Not Found [IP: 91.189.91.23 80] E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_4.15.0-39.42_amd64.deb 404 Not Found [IP: 91.189.91.23 80] E: Aborting install.
按提示进行安装,却报404。这时候,可以考虑将源修改为国内的,例如阿里的源:
1 2 3 4 5 6 7 8 9 10 11
$ cd /etc/apt/ $ sudo cp sources.list sources.list_bak $ sudo vi sources.list
在文件的最后,加上下面的内容: # https://opsx.alibaba.com/mirror deb https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
c 切换显示命令名称和完整命令行
M 根据驻留内存大小进行排序
P 根据CPU使用百分比大小进行排序
k 终止一个进程。系统将提示用户输入需要终止的进程PID,以及需要发送给该进程什么样的信号。一般的终止进程可以使用15信号;如果不能正常结束那就使用信号9强制结束该进程。默认值是信号15。在安全模式中此命令被屏蔽
top常用命令参数 top 每隔5秒显式所有进程的资源占用情况 top -d 2 每隔2秒显式所有进程的资源占用情况 top -c 每隔5秒显式进程的资源占用情况,并显示进程的命令行参数(默认只有进程名) top -p 3306 -p 6378 每隔5秒显示pid是3306和pid是6379的两个进程的资源占用情况 top -d 2 -c -p 6379 每隔2秒显示pid是6379的进程的资源使用情况,并显示该进程启动的命令行参数
From source CentOS repository doesn’t have a RPM package for MSMTP so we need to install it from source:
yum -y install make pkgconfig gcc gcc-c++ gnutls gnutls-devel gnutls-utils openssl openssl-devel libidn libidn-devel
wget https://marlam.de/msmtp/releases/msmtp-1.8.12.tar.xz
tar xJvf msmtp-1.8.12.tar.xz
cd msmtp-1.8.12/
./configure --with-ssl=openssl
make
make install
On Ubuntu/Debian distribution use apt-get:
sudo apt-get install msmtp
配置 The configuration file of MSMTP is stored in ~/.msmtprc for each user and /etc/msmtprc is the system wide configuration file. Open the configuration file in your directory.
vi ~/.msmtprc
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
defaults tls on logfile /var/log/msmtp.log
account th host smtp.exmail.qq.com port 465 auth on tls on tls_starttls off tls_certcheck off from test@th.com user test@th.com password yourThPassw0rd
account default: th
This file can also have more than one account, just ensure that the “account” value is unique for each section. When sending with -a {accountId} to specific the account. Save the file and use chmod to make this file readable only by the owner since it contains passwords. This step is mandatory because msmtp won’t run if the permissions are more than 600.
chmod 600 ~/.msmtprc
check from the command-line to ensure it works properly. To do this:
echo -e "Subject: test msmtp\r\n\r\nThis is a test for th." | /usr/bin/msmtp -d -C ~/.msmtprc -t wentian.he@qq.com
echo -e "Subject: test msmtp\r\n\r\nThis is a test for th." | /usr/bin/msmtp -d -C ~/.msmtprc -t wentian.he@qq.com,other@qq.com # 可以同时给多个地址发邮件
if everything is setup correctly, you can copy this file to the/etc directory, but this is option:
# 下面进行判断 if [ $disk_used_percent -gt 10 ];then msg="disk used: ${disk_used} / ${disk_total}, ${disk_used_percent}%" fi
if [ $mem_used_percent -gt 30 ];then msg=$msg"\nmem used: ${mem_used}M / ${mem_total}M, ${mem_used_percent}%" fi
if [ $cpu_idle -lt 99 ];then msg=$msg"\ncpu idle: ${cpu_idle}%" fi
echo""
if [ -n "$msg" ]; then msg="ip: ${ip}\n"$msg echo"${msg}" echo"Subject: system monitor\r\n\r\n${msg}" | /usr/bin/msmtp -d -C ~/.msmtprc -t wentian.he@qq.com fi
# Note: to enable "laptop mode" (to spin down your hard drive for longer
# periods of time), install the laptop-mode-tools package and configure
# it in /etc/laptop-mode/laptop-mode.conf.
打开/etc/laptop-mode/laptop-mode.conf文件,设置以下项
# Enable laptop mode power saving, when on battery power.
#
ENABLE_LAPTOP_MODE_ON_BATTERY=1
#
# Enable laptop mode power savings, even when on AC power.
# This is useful when running as a headless machine, in low power mode
#
ENABLE_LAPTOP_MODE_ON_AC=1
#
# Enable laptop mode when the laptop's lid is closed, even when we're on AC
# power? (ACPI-ONLY)
#
ENABLE_LAPTOP_MODE_WHEN_LID_CLOSED=1
If you have already configured the Host Manager application to allow access and you have used your browsers back button, used a saved book-mark or similar then you may have triggered the cross-site request forgery (CSRF) protection that has been enabled for the HTML interface of the Host Manager application. You will need to reset this protection by returning to the main Host Manager page. Once you return to this page, you will be able to continue using the Host Manager application's HTML interface normally. If you continue to see this access denied message, check that you have the necessary permissions to access this application.
If you have not changed any configuration files, please examine the file conf/tomcat-users.xml in your installation. That file must contain the credentials to let you use this webapp.
For example, to add the admin-gui role to a user named tomcat with a password of s3cret, add the following to the config file listed above.
Note that for Tomcat 7 onwards, the roles required to use the host manager application were changed from the single admin role to the following two roles. You will need to assign the role(s) required for the functionality you wish to access.
admin-gui - allows access to the HTML GUI admin-script - allows access to the text interface The HTML interface is protected against CSRF but the text interface is not. To maintain the CSRF protection:
Users with the admin-gui role should not be granted the admin-script role. If the text interface is accessed through a browser (e.g. for testing since this interface is intended for tools not humans) then the browser must be closed afterwards to terminate the session.