最基本的 Linux 虚拟机配置(文末有已完成基本配置的 CentOS 7 系统链接供小白直接使用)
一. 新建虚拟机
点击从光盘或映像中安装,选择默认的CentOS 7系统安装文件(点击该链接百度网盘直接下载https://pan.baidu.com/s/1OS-sEpMdowTuKZRRbFBEjw,但未必长期保存,可尝试),如下图所示:
点击继续后
可以使用快捷安装,可以在此输入你想要的显示名称、账户名及密码。
直接继续即可,内存可以根据电脑具体情况而定,1~2 GB正常操作够了。
点击 完成 - 存储 即可。
接下来,点击 文件 - 打开并运行,选择刚安装好的 CentOS 7 64 位光盘,开始正式安装系统。
漫长的等待之后…
如果只想用 root 管理员账户(推荐新手这样就行了)
,不需要进行 user creation,直接等待即可。 root password is set 是因为刚才快捷安装的时候已设定。
密码我统一设定为:learnlinux
好啦,等了很久,系统安装完输入密码,就可以开始我们的 mysql 安装啦!
二、安装 MySQL
我首先针对可访问外网的朋友们进行不修改镜像源教学:
在 Linux 系统上安装 MySQL 的步骤可能会因使用的 Linux 发行版(例如 CentOS、RHEL、Ubuntu、Debian 等)而有所不同。下面我将分别介绍在 CentOS/RHEL 和 Ubuntu/Debian 系统上安装 MySQL 的方法。
在 CentOS/RHEL 上安装 MySQL
-
下载并安装 MySQL 的官方 Yum Repository:
wget https://dev.mysql.com/get/mysql80-community-release-el7-9.noarch.rpm sudo rpm -ivh mysql80-community-release-el7-9.noarch.rpm
-
安装 MySQL 社区服务器:
sudo yum install mysql-community-server
执行这一步八成是会报错的
[user@localhost ~]$ sudo yum install mysql-community-server Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error" One of the configured repositories failed (Unknown), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this: 1. Contact the upstream for the repository and get them to fix the problem. 2. Reconfigure the baseurl/etc. for the repository, to point to a working upstream. This is most often useful if you are using a newer distribution release than is supported by the repository (and the packages for the previous distribution release still work). 3. Run the command with the repository temporarily disabled yum --disablerepo=<repoid> ... 4. Disable the repository permanently, so yum won't use it by default. Yum will then just ignore the repository until you permanently enable it again or use --enablerepo for temporary usage: yum-config-manager --disable <repoid> or subscription-manager repos --disable=<repoid> 5. Configure the failing repository to be skipped, if it is unavailable. Note that yum will try to contact