【踩坑】关于解决ubuntu18环境下安装LAMP时无法安装phpmyadmin

1.何为LAMP

linux+mysql+php+apache2的简称。我在linux环境下搭建apache2服务器,同时安装php7,mysql,还有其他依赖的包。我将我以前设计的某个简单网页index.html放在/var/www/index目录后,目录可在配置文件配置,你有可能是/var/www/html目录,自己设置,自己开心就好,

sudo /etc/init.d/apache2 restart 开始运行apache2服务,页面长这个样子,我是在window去访问搭建在虚拟机linux下的页面

2.在目录www下放置index.php来验证我的php和mysql安装成功了与否

index.php内容

<?php 
phpinfo();
?>

访问:ip/index.php

3.phpmyadmin无法安装的问题

sudo apt-get install phpmyadmin后发现apache2服务自动停止,根本restart不了,将输出的报错信息去寻找解决方案也没知道,后来卸掉phpmyadmin后,apache2又自动可以工作,重新安装phpmyadmin后apache2又不能工作。但是发现安装phpmyadmin 时phpmyadmin居然也下了依赖php5相关的包!!!!!!网上没有找到解决方案,apt-get update也不管用,后来修改了apt源之后就阔以了,惊呆了,我之前修改过源,因为原来的源太慢了,修改为阿里源,庆幸我备过份,在此,放一下这个源

# deb cdrom:[Ubuntu 18.04.2 LTS _Bionic Beaver_ - Release amd64 (20190210)]/ bionic main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://cn.archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic universe
deb http://cn.archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://cn.archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://cn.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

deb http://security.ubuntu.com/ubuntu bionic-security main restricted
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse

然后sudo apt-get update一下,过程比阿里源的比较慢一些,然后 sudo apt-get install phpmyadmin然后apache2依然可以工作,因为它依赖并下载了php7相关的包了建立软连接到index目录下,sudo ln -s /usr/share/phpmyadmin /var/www/index/phpmyadmin,再访问  你的ip/phpmyadmin  就可以啦

 

-------------------------------------------------------------------------------------------欢迎讨论

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章