虚拟机下Linux操作Ubuntu

Posted 0xthonsun

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了虚拟机下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环境安装

[email protected]:/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
# [email protected]
# 禁用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的主要内容,如果未能解决你的问题,请参考以下文章

Linux使用_VM虚拟机下Ubuntu初次使用配置

VMWare虚拟机下为Ubuntu 12.04.1配置静态IP_转

VMWare虚拟机下为Ubuntu 配置静态IP(NAT方式)ping通主机

VMWare虚拟机下为Ubuntu 12.04.1配置静态IP(NAT连接方式)

虚拟机下的ubuntu怎样连接wifi

虚拟机下的ubuntu怎么全屏,分辨率怎么调。语言怎么调?