【踩坑】關於解決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  就可以啦

 

-------------------------------------------------------------------------------------------歡迎討論

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