ubuntu用oneinstack 一键安装php 遇见的问题
报错:configure: error: libxml2 not found. Please check your libxml2 installation.
- 去安装 libxml2:
apt-get install libxml2
- 接着报错:
E:无法定位软件包libxml2
参考[1]: https://www.kanzhun.com/jiaocheng/198475.html
结论: 说白了,就是大家在使用ubuntu的时候源的问题
- 解决办法(有限试用清华源和网易源)
更新源为 网易源
#备份源为/etc/apt/sources.list.back
sudo cp /etc/apt/sources.list /etc/apt/sources.list.back
#编辑源的文件
vi /etc/apt/sources.list
#粘贴内容如下:
deb http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
保存,然后更新 /etc/apt/sources.list 中的源
sudo apt-get update
再升级源
sudo apt-get upgrade
- 我这里又碰见了报错:
E: 无法获得锁 /var/lib/apt/lists/lock – open (11: 资源暂时不可用)
E: 无法对目录 /var/lib/apt/lists/ 加锁
办法:
ps -ef|grep apt-get
获取到pid
然后kill -9 此pid
重新执行:
sudo apt-get upgrade
- 又报错:
W: GPG 错误:http://ppa.launchpad.net/fossfreedom/indicator-sysmonitor/ubuntu xenial InRelease: 由于没有公钥,无法验证下列签名: NO_PUBKEY F42ED6FBAB17C654
解决办法:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654
注意行末参数改成上一行报错的(每个人报错的签名可能不一样):
F42ED6FBAB17C654
- 重新执行:
sudo apt-get upgrade
最后的最后:
#安装libxml2 依赖
apt-get install libxml2
# 使用oneinstack 脚本安装php
wget -c http://mirrors.linuxeye.com/oneinstack-full.tar.gz && tar xzf oneinstack-full.tar.gz && ./oneinstack/install.sh --php_option 7 --php_extensions gmagick,fileinfo,yaf,redis,memcached,mongodb,swoole --phpmyadmin --pureftpd --redis --memcached --ssh_port 22 --reboot
2021.09.02 续:
后来发现不必安装libxml2,
安装libxml2-dev即可
ubuntu/debian:
apt-get install libxml2-dev
centos/redhat:
yum install libxml2-devel