虛擬機下Linux操作Ubuntu
備忘Ubuntu虛擬機環境配置
目錄
更新源修改
#支持https的下載 apt 源使用 HTTPS 以確保軟件下載過程中不被篡改。因此,我們首先需要添加使用 HTTPS 傳輸的軟件包以及 CA 證書 sudo apt-get install apt-transport-https ca-certificates curl software-properties-common sudo gedit /etc/apt/sources.list # 默認註釋了源碼鏡像以提高 apt update 速度,如有需要可自行取消註釋 16.04 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse # 預發布軟件源,不建議啟用 # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse # 19.04 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
LAMP環境安裝
root@kali:/home/kali# systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2018-10-16 00:00:57 CST; 25s ago
Process: 47576 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)10月 16 00:00:57 kali mysql-systemd-start[47576]: Once the problem is resolved, restart the service.
10月 16 00:00:57 kali systemd[1]: mysql.service: Control process exited, code=exited status=1
10月 16 00:00:57 kali systemd[1]: mysql.service: Failed with result ‘exit-code‘.
10月 16 00:00:57 kali systemd[1]: Failed to start MySQL Community Server.
10月 16 00:00:57 kali systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
10月 16 00:00:57 kali systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
10月 16 00:00:57 kali systemd[1]: Stopped MySQL Community Server.
10月 16 00:00:57 kali systemd[1]: mysql.service: Start request repeated too quickly.
10月 16 00:00:57 kali systemd[1]: mysql.service: Failed with result ‘exit-code‘.
10月 16 00:00:57 kali systemd[1]: Failed to start MySQL Community Server.
apt-get remove mariadb-server mariadb-client --purge # 清除記錄
sudo apt-get install mysql-server mysql-client # 沒有成功
sudo apt-get update && sudo apt-get upgrade
apt-get install apache2
apt-get install php7.0
apache2 -v
php -v #php7.0 -v
apt-get install libapache2-mod-php7.0
cat /etc/apache2/mods-enabled/php7.0.load
apt-get install mysql-server
apt-get install php7.0-mysql
service mysql restart
service apache2 restart
# sudo apt install apache2 php7.0 mysql5.7-server php7.0-mysql libapache2-mod-php7.0 phpmyadmin
# thonsun123@
# 禁用event模塊,啟用prefork模塊(Apache默認的multi-processing模塊(MPM) 是一個event模塊, 但是 php默認是使用prefork模塊)
# sudo a2dismod mpm_event
# sudo a2enmod mpm_prefork
# 重啟apache
# service apache2 restart
# 修改默認訪問路徑
# 找到下面這行,修改`/phpmyadmin`為自定義的名稱,即phpmyadmin訪問路徑
# Alias /phpmyadmin /usr/share/phpmyadmin
# 不用的時候關閉phpmyadmin,方法如下
# 找到下面這行
# <Directory /usr/share/phpmyadmin>
# 在最後添加
# Order Deny,Allow
# Deny from all
# Allow from 127.0.0.1
# 或者直接
# Require all denied
記錄
57 apt-get remove mariadb-server mariadb-client
58 apt-get remove mysql-* --purge
59 apt install apache2 php7.0 mysql5.7-server php7.0-mysql libapache2-mod-php7.0 phpmyadmin
60 apache2 -v
61 php7.0 -v
62 php -v
63 apt-get install libapache2-mod-php7.0
64 apt-get install mysql-server
65 apt-get update
66 apt-get -f install
67 apt-get upgrade
68 apt-get clean
69 apt-get update
70 gedit /etc/apt/sources.list
71 apt-get update
72 rm /var/lib/apt/lists/* -vf
73 apt-get update
74 rm -rf /var/lib/apt/lists/*
75 apt-get update
76 apt-get install -f
77 apt-get install mysql
78 apt-get install mysql-server
79 gedit /etc/apt/sources.list
80 apt-get update
81 apt-get upgrade
82 apt-get install -f
83 apache2 -v
84 php -v
85 mysql -v
86 apt-get install libapache2-mod-php7.0
87 cat /etc/apache2/mods-enabled/php7.0.load
88 apt-get install mysql-server
89 apt-get install php7.0-mysql
90 service mysql restart
91 service apache2 restart
linux常用操作
文件管理:文件與文件夾管理
mkdir 目錄要一個個來創建
rmdir
rm
rm -rf 非空文件夾
touch +filename
虛擬機下Linux操作Ubuntu