libvirt2.0安装
1.libvirt介绍
Libvirt是用于管理虚拟化平台的开源的API,后台程序和管理工具。它可以用于管理KVM、Xen、VMware ESX,QEMU和其他虚拟化技术。网上有很多文章做介绍,这里就不详细介绍了。libvirt本身安装过程没有什么难度,主要在于原生的centos会自带一个版本的libvirt,同时,如果自行编译的版本在安装之前,没有把发行版自带的libvirt卸载干净,就会出现各种各样的错误。笔者工作较忙,时间比较仓促,排版可能不太好看,请见谅。
2.卸载系统自带的libvirt
2.1.查看当前安装的libvirt相关包
[root@localhost libvirt-2.0.0]# rpm -qa |grep libvirt
2.2.全部卸载掉
由于目前笔者的环境已经是卸载干净的,因此,此处不做演示了
[root@localhost libvirt-2.0.0]# yum remove `rpm -qa |grep libvirt`
3.使用tar包编译安装
3.1.解压缩
[root@localhost home]# tar xvf libvirt-2.0.0.tar.xz
3.2.生成Makefile文件
注意:如果./configure不带任何参数,各种文件会被安装到诸如/usr/local,/var/local下面,这样和原生安装路径不一致,通常不要
这样安装[1]
./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc --enable-debug=yes $ make $ sudo make install
3.3.错误处理
错误1:需要安装依赖关系:
configure: error: You must install the pciaccess module to build with udev
[root@localhost libvirt-2.0.0]# yum install libpciaccess-devel
configure: error: You must install the libyajl library & headers to compile libvirt
[root@localhost libvirt-2.0.0]# yum install yajl-devel
configure: error: You must install device-mapper-devel/libdevmapper >= 1.0.0 to compile libvirt
[root@localhost libvirt-2.0.0]# yum install device-mapper-devel
configure: error: xml2-config not found. Please check your libxml2 installation.
yum -y install libxml2-devel
configure: error: libnl-devel >= 1.1 is required for macvtap support
configure: error: You must install the pciaccess module to build with udev
[root@localhost libvirt-2.0.0]# yum install libpciaccess-devel
configure: error: You must install the libyajl library & headers to compile libvirt
[root@localhost libvirt-2.0.0]# yum install yajl-devel
configure: error: You must install device-mapper-devel/libdevmapper >= 1.0.0 to compile libvirt
[root@localhost libvirt-2.0.0]# yum install device-mapper-devel
configure: error: xml2-config not found. Please check your libxml2 installation.
yum -y install libxml2-devel
错误2
没有卸载系统自带的,直接安装的新的,但是版本一样
#查看服务状态
[root@192 libvirt-2.0.0]# systemctl status libvirtd
● libvirtd.service - Virtualization daemon
Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Sun 2019-04-21 16:48:37 CST; 25s ago
Docs: man:libvirtd(8)
http://libvirt.org
Process: 79857 ExecStart=/usr/sbin/libvirtd $LIBVIRTD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 79857 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/libvirtd.service
├─2705 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
└─2706 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
Apr 21 16:48:36 localhost.localdomain systemd[1]: Started Virtualization daemon.
Apr 21 16:48:36 localhost.localdomain libvirtd[79857]: libvirt version: 2.0.0, package: 10.el7 (CentOS BuildSystem <http://bugs.centos.org>, 2016-11-12-02:15:12, c...entos.org)
Apr 21 16:48:36 localhost.localdomain libvirtd[79857]: hostname: localhost.localdomain
Apr 21 16:48:36 localhost.localdomain libvirtd[79857]: operation failed: network 'default' already exists with uuid 0c2459eb-2797-4a07-93af-6fb5857a6831
Apr 21 16:48:37 localhost.localdomain dnsmasq[2705]: read /etc/hosts - 2 addresses
Apr 21 16:48:37 localhost.localdomain dnsmasq[2705]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses
Apr 21 16:48:37 localhost.localdomain dnsmasq-dhcp[2705]: read /var/lib/libvirt/dnsmasq/default.hostsfile
Apr 21 16:48:37 localhost.localdomain libvirtd[79857]: internal error: failed to initialize netcf
Apr 21 16:48:37 localhost.localdomain libvirtd[79857]: Initialization of netcf state driver failed: internal error: failed to initialize netcf
Apr 21 16:48:37 localhost.localdomain libvirtd[79857]: Driver state initialization failed
Hint: Some lines were ellipsized, use -l to show in full.
处理方式,杀死残余进程
[root@192 libvirt-2.0.0]# ps -ef|grep libvirt
nobody 2705 1 0 12:20 ? 00:00:00 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
root 2706 2705 0 12:20 ? 00:00:00 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
root 79999 3730 0 16:52 pts/0 00:00:00 grep --color=auto libvirt
[root@192 libvirt-2.0.0]# kill -9 2705
[root@192 libvirt-2.0.0]# ps -ef|grep libvirt
root 80016 3730 0 16:53 pts/0 00:00:00 grep --color=auto libvirt
libvirt可以正常工作,但是依然有报错
Apr 21 16:53:45 localhost.localdomain libvirtd[80026]: operation failed: network 'default' already exists with uuid 0c2459eb-2797-4a07-93af-6fb5857a6831
查看libvirt网络配置
[root@192 libvirt-2.0.0]# virsh net-list --all
Name State Autostart Persistent
---------------------------------------------------
default active no no
查看网络的xml
[root@192 libvirt-2.0.0]# virsh net-dumpxml default
<network>
<name>default</name>
<uuid>0c2459eb-2797-4a07-93af-6fb5857a6831</uuid>
<forward mode='nat'>
<nat>
<port start='1024' end='65535'/>
</nat>
</forward>
<bridge name='virbr0' stp='on' delay='0'/>
<mac address='52:54:00:38:f8:e0'/>
<ip address='192.168.122.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.122.2' end='192.168.122.254'/>
</dhcp>
</ip>
</network>
删除该net之后重启libvirt进程遇到新问题
Apr 21 19:18:52 localhost.localdomain libvirtd[82476]: Initialization of netcf state driver failed: internal error: failed to initialize netcf
关闭selinux之后,正常
[root@localhost ~]# setenforce 0
网络也重新生成了[2]
[root@localhost ~]# virsh net-list
Name State Autostart Persistent
----------------------------------------------------------
default active yes yes
错误3
virsh: error while loading shared libraries: libvirt-lxc.so.0: cannot open shared object file: No such file or directory
这是因为动态库更新了,没有刷新,需要刷新一下
bash-4.2# ldconfig
bash-4.2# virsh --version
2.0.0
错误4
[root@localhost libvirt-2.0.0]# virsh list
error: failed to connect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
这是因为进程没有启动
[root@localhost libvirt-2.0.0]# systemctl start libvirtd
[root@localhost libvirt-2.0.0]# systemctl status libvirtd
● libvirtd.service - Virtualization daemon
Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2019-05-15 10:28:31 EDT; 5s ago
Docs: man:libvirtd(8)
http://libvirt.org
Main PID: 81685 (libvirtd)
CGroup: /system.slice/libvirtd.service
├─81685 /usr/sbin/libvirtd
├─81825 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshe...
└─81826 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshe...
May 15 10:28:31 localhost.localdomain systemd[1]: Started Virtualization daemon.
May 15 10:28:33 localhost.localdomain dnsmasq[81825]: started, version 2.76 cachesize 150
May 15 10:28:33 localhost.localdomain dnsmasq[81825]: compile time options: IPv6 GNU-getopt DBus no-i18n IDN DHCP DHCPv6 no-Lua TFTP no...notify
May 15 10:28:33 localhost.localdomain dnsmasq-dhcp[81825]: DHCP, IP range 192.168.122.2 -- 192.168.122.254, lease time 1h
May 15 10:28:33 localhost.localdomain dnsmasq-dhcp[81825]: DHCP, sockets bound exclusively to interface virbr0
May 15 10:28:33 localhost.localdomain dnsmasq[81825]: reading /etc/resolv.conf
May 15 10:28:33 localhost.localdomain dnsmasq[81825]: using nameserver 192.168.233.2#53
May 15 10:28:33 localhost.localdomain dnsmasq[81825]: read /etc/hosts - 2 addresses
May 15 10:28:33 localhost.localdomain dnsmasq[81825]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses
May 15 10:28:33 localhost.localdomain dnsmasq-dhcp[81825]: read /var/lib/libvirt/dnsmasq/default.hostsfile
Hint: Some lines were ellipsized, use -l to show in full.
4.使用src.rpm包安装
由于笔者实验环境不小心被破坏,为了以后再出问题可以更快的恢复编译环境,选择使用在chroot的jail里面搭建一个编译环境,方便备份和还原,但是使用这种方式, make完了之后,无法在宿主环境中make install,缺少很多东西,但是又不想在jail之外的环境安装过多的依赖包,否则就违背了初衷,因此,决定尝试用src.rpm包来编译安装(此处都是基于chroot环境在操作,普通环境操作方式一样,除了yum install的路径不同)
4.1.首先安装rpm包
bash-4.2# rpm -i libvirt-2.0.0-1.fc23.src.rpm
warning: libvirt-2.0.0-1.fc23.src.rpm: Header V4 DSA/SHA1 Signature, key ID de95bc1f: NOKEY
warning: user veillard does not exist - using root
warning: group veillard does not exist - using root
warning: user veillard does not exist - using root
warning: group veillard does not exist - using root
4.2.进入rpmbuild目录执行spec文件
bash-4.2# cd /root/rpmbuild/
bash-4.2# ll
total 8
drwxr-xr-x. 2 root root 4096 Aug 11 06:52 SOURCES
drwxr-xr-x. 2 root root 4096 Aug 11 06:52 SPECS
bash-4.2# rpmbuild -bp S
SOURCES/ SPECS/
bash-4.2# rpmbuild -bp SPECS/libvirt.spec
error: Failed build dependencies:
xhtml1-dtds is needed by libvirt-2.0.0-1.el7.x86_64
libxslt is needed by libvirt-2.0.0-1.el7.x86_64
readline-devel is needed by libvirt-2.0.0-1.el7.x86_64
ncurses-devel is needed by libvirt-2.0.0-1.el7.x86_64
libtasn1-devel is needed by libvirt-2.0.0-1.el7.x86_64
gnutls-devel is needed by libvirt-2.0.0-1.el7.x86_64
libattr-devel is needed by libvirt-2.0.0-1.el7.x86_64
libblkid-devel >= 2.17 is needed by libvirt-2.0.0-1.el7.x86_64
augeas is needed by libvirt-2.0.0-1.el7.x86_64
sanlock-devel >= 2.4 is needed by libvirt-2.0.0-1.el7.x86_64
libpcap-devel is needed by libvirt-2.0.0-1.el7.x86_64
libnl3-devel is needed by libvirt-2.0.0-1.el7.x86_64
avahi-devel is needed by libvirt-2.0.0-1.el7.x86_64
dnsmasq >= 2.41 is needed by libvirt-2.0.0-1.el7.x86_64
radvd is needed by libvirt-2.0.0-1.el7.x86_64
ebtables is needed by libvirt-2.0.0-1.el7.x86_64
cyrus-sasl-devel is needed by libvirt-2.0.0-1.el7.x86_64
polkit-devel >= 0.112 is needed by libvirt-2.0.0-1.el7.x86_64
/usr/bin/qemu-img is needed by libvirt-2.0.0-1.el7.x86_64
iscsi-initiator-utils is needed by libvirt-2.0.0-1.el7.x86_64
parted-devel is needed by libvirt-2.0.0-1.el7.x86_64
librados2-devel is needed by libvirt-2.0.0-1.el7.x86_64
librbd1-devel is needed by libvirt-2.0.0-1.el7.x86_64
glusterfs-api-devel >= 3.4.1 is needed by libvirt-2.0.0-1.el7.x86_64
glusterfs-devel >= 3.4.1 is needed by libvirt-2.0.0-1.el7.x86_64
libcap-ng-devel >= 0.5.0 is needed by libvirt-2.0.0-1.el7.x86_64
fuse-devel >= 2.8.6 is needed by libvirt-2.0.0-1.el7.x86_64
netcf-devel >= 0.2.2 is needed by libvirt-2.0.0-1.el7.x86_64
libcurl-devel is needed by libvirt-2.0.0-1.el7.x86_64
audit-libs-devel is needed by libvirt-2.0.0-1.el7.x86_64
systemtap-sdt-devel is needed by libvirt-2.0.0-1.el7.x86_64
nfs-utils is needed by libvirt-2.0.0-1.el7.x86_64
dbus-devel is needed by libvirt-2.0.0-1.el7.x86_64
scrub is needed by libvirt-2.0.0-1.el7.x86_64
numad is needed by libvirt-2.0.0-1.el7.x86_64
4.3.逐一修复依赖关系
yum --installroot=/home/user3/jail install -y xhtml1-dtds
yum --installroot=/home/user3/jail install -y libxslt
yum --installroot=/home/user3/jail install -y readline-devel
yum --installroot=/home/user3/jail install -y libtasn1-devel
yum --installroot=/home/user3/jail install -y gnutls-devel
yum --installroot=/home/user3/jail install -y libattr-devel
yum --installroot=/home/user3/jail install -y libblkid-devel
yum --installroot=/home/user3/jail install -y augeas sanlock-devel sanlock
yum --installroot=/home/user3/jail install -y libpcap-devel
...
最后再次尝试,
bash-4.2# rpmbuild -bp SPECS/libvirt.spec
error: Failed build dependencies:
/usr/bin/qemu-img is needed by libvirt-2.0.0-1.el7.x86_64
只剩下这一个,安装了该文件也无法解决,原因未知,因此查阅资料[3],得知,这个不重要,因此可以修改spec文件,注释掉这个。
# From QEMU RPMs
# BuildRequires: /usr/bin/qemu-img
根据
./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc --enable-debug=yes
在spec文件configure处增加--enable-debug
执行编译
bash-4.2# rpmbuild -bb SPECS/libvirt.spec
如果成功,则会生成
bash-4.2# ll RPMS/x86_64/
total 21284
-rw-r--r--. 1 root root 2716 Aug 11 07:47 libvirt-2.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 4380632 Aug 11 07:47 libvirt-client-2.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 588380 Aug 11 07:47 libvirt-daemon-2.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 3868 Aug 11 07:47 libvirt-daemon-config-network-2.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 6356 Aug 11 07:47 libvirt-daemon-config-nwfilter-2.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 47564 Aug 11 07:47 libvirt-daemon-driver-interface-2.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 669320 Aug 11 07:47 libvirt-daemon-driver-lxc-2.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 202876 Aug 11 07:47 libvirt-daemon-driver-network-2.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 46672 Aug 11 07:47 libvirt-daemon-driver-nodedev-2.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 71392 Aug 11 07:47 libvirt-daemon-driver-nwfilter-2.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 478708 Aug 11 07:47 libvirt-daemon-driver-qemu-2.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 36804 Aug 11 07:47 libvirt-daemon-driver-secret-2.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 233904 Aug 11 07:47 libvirt-daemon-driver-storage-2.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 1984 Aug 11 07:47 libvirt-daemon-kvm-2.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 1956 Aug 11 07:47 libvirt-daemon-lxc-2.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 10537260 Aug 11 07:47 libvirt-debuginfo-2.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 152084 Aug 11 07:47 libvirt-devel-2.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 3781352 Aug 11 07:47 libvirt-docs-2.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 52048 Aug 11 07:47 libvirt-lock-sanlock-2.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 334884 Aug 11 07:47 libvirt-login-shell-2.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 123980 Aug 11 07:47 libvirt-nss-2.0.0-1.el7.x86_64.rpm
然后安装所有的rpm包
[root@localhost home]# rpm -i /home/user3/jail/root/rpmbuild/RPMS/x86_64/*
可能会提示缺包,yum安装一下就行了
[root@localhost home]# yum install -y augeas sanlock-devel sanlock
启动libvirtd进程
[root@localhost home]# systemctl start libvirtd
[root@localhost home]# virsh list
Id Name State
----------------------------------------------------
[root@localhost home]# virsh -v
2.0.0
安装成功,查看libvirtd的路径
[root@localhost home]# ps -ef|grep libvirtd
root 16193 1 0 16:04 ? 00:00:00 /usr/sbin/libvirtd
root 16407 21296 0 16:07 pts/0 00:00:00 grep --color=auto libvirtd
经过测试,可以正常启动虚拟机
4.4.错误处理
错误1.无法启动虚拟机
[root@localhost user3]# virsh start vm_vbras_64
error: Failed to start domain vm_vbras_64
error: Failed to connect socket to '/var/run/libvirt/virtlogd-sock': Connection refused
可能是因为重装之前有相关进程没杀掉,这个东西具体做什么的还没有研究
[root@localhost user3]# ll /var/run/libvirt/virtlogd-sock
srw-rw-rw-. 1 root root 0 Aug 11 11:57 /var/run/libvirt/virtlogd-sock
[root@localhost user3]# systemctl stop libvirtd
[root@localhost user3]# rm /var/run/libvirt/virtlogd-sock
rm: remove socket ‘/var/run/libvirt/virtlogd-sock’? y
[root@localhost ~]# /usr/sbin/virtlogd --daemon
[root@localhost user3]# systemctl start libvirtd
再重新执行即可正常启动虚拟机
更新日期:20190911,长期更新维护...
libvirt2.0安装的更多相关文章
- 记:MySQL 5.7.3.0 安装 全程截图
前言: 下一个班快讲MySQL数据库了,正好把服务器里面的MySQL卸了重装了一下. 截个图,作为笔记.也正好留给需要的朋友们. 目录: 下载软件 运行安装程序 安装程序欢迎界面 许可协议 查找更新 ...
- 烂泥:zabbix3.0安装与配置
本文由ilanniweb提供友情赞助,首发于烂泥行天下 想要获得更多的文章,可以关注我的微信ilanniweb 这个月又快过完了,最近也比较忙,没时间写文章,今天挤点时间把zabbix3.0安装与配置 ...
- CentOS 7.0安装配置Vsftp服务器
一.配置防火墙,开启FTP服务器需要的端口 CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop fi ...
- elasticsearch5.0.0 安装插件及配置过程
elasticsearch5.0.0 安装插件及配置过程 由于es5.0是里程碑式的更新,所以很多变化的地方,暂时我就插件安装遇到的问题记录一下. 插件安装命令 2.3版本的安装命令 安装Marvel ...
- IIS和4.0安装到底有没有先后顺序解答
在很多人或许很多技术大神都会觉得IIS的安装和4.0没得先后顺序的.其错误弊端在与IIS没有注册到4.0上. 经过今天遇到了服务器安装服务端发觉报错[无法识别的属性“targetFramework”. ...
- Hadoop2.6.0安装 — 集群
文 / vincentzh 原文连接:http://www.cnblogs.com/vincentzh/p/6034187.html 这里写点 Hadoop2.6.0集群的安装和简单配置,一方面是为自 ...
- zabbix3.0安装部署文档
zabbix v3.0安装部署 摘要: 本文的安装过程摘自http://www.ttlsa.com/以及http://b.lifec-inc.com ,和站长凉白开的<ZABBIX从入门到精通v ...
- [转]phoneGap3.0安装步骤(以windows下的android环境为例):
phoneGap3.0安装步骤(以windows下的android环境为例): 环境: WIN系统,JDK,Android,Eclipse,Ant,Git,PhoneGap3.x (Cordova) ...
- Node Express 4.0 安装
前言 今天想要用nodejs 写个后台服务,很久之前看过node express 框架,可真当向下手安装的时候,发现好多命令都不记得了.写完后台服务,没事了,总结了下安装过程,记录一下,以便以后查阅方 ...
随机推荐
- 7月新的开始 - Axure学习01 - 元件库、元件交互样式设置
解释: Axure 属于原型制作里的霸道总裁 1.原型:原型模拟真实产品的功能与设计.用于在初期阶段测试产品的可行性与效果.来节省开发成本与周期. 2.线框图:在初期实现对产品的了解.实现产品的基本结 ...
- 6、Spring Boot 2.x 集成 MyBatis
1.6 Spring Boot 2.x 集成 MyBatis 简介 详细介绍如何在Spring Boot中整合MyBatis,并通过注解方式实现映射. 完整源码: 1.6.1 创建 spring-bo ...
- java中vector中add,addElement区别
这两个方法最大的区别就是返回值不一样,在作用上基本没有区别. add是实现List接口重写的方法,返回值为boolean.addElement是Vector类中的特有方法,返回值是void.
- [Luogu] 校园网Network of Schools
https://www.luogu.org/problemnew/show/2746 Tarjan 缩点 判断入度为0的点的个数与出度为0的点的个数的关系 注意全缩为一个点的情况 #include & ...
- Ubuntu 14.04 更换为阿里云源
#备份sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak#编辑sudo vim /etc/apt/sources.list,清空后,加入以下 ...
- scrapy框架之items项目
Items 主要目标是从非结构化来源(通常是网页)提取结构化数据.Scrapy爬虫可以将提取的数据作为Python语句返回.虽然方便和熟悉,Python dicts缺乏结构:很容易在字段名称中输入错误 ...
- Pstools使用
pstool的介绍 PsTools是Sysinternals Suite中一款排名靠前的一个安全管理工具套件.现在被微软收购.目前pstools中含有12款各式各样的小工具.如果将它们灵活的运用,将会 ...
- Leetcode题目300.最长上升子序列(动态规划-中等)
题目描述: 给定一个无序的整数数组,找到其中最长上升子序列的长度. 示例: 输入: [10,9,2,5,3,7,101,18] 输出: 4 解释: 最长的上升子序列是 [2,3,7,101],它的长度 ...
- pwn学习日记Day22 《程序员的自我修养》读书笔记
知识杂项 软连接 命令: ln -s 原文件 目标文件 特征: 1.相当于windows的快捷方式 2.只是一个符号连接,所以软连接文件大小都很小 3.当运行软连接的时候,会根据连接指向找到真正的文件 ...
- Linux设备驱动程序 之 后备高速缓存
设备驱动程序常常会反复的分配很多相同大小的内存块:内核实现了后备高速缓存来对此进行支持,以反复的使用这些相同的内存块: 创建 Linux内核的高速缓存管理有时被称为“slab分配器”:因此,相关函数和 ...