手把手VMware安装Ubuntu18.4及远程连接和LAMP环境部署

9 篇文章 0 订阅
3 篇文章 0 订阅

Ubuntu作为很多docker环境中的默认系统,还是值得学习的,本文包含在VMware中安装,网络相关配置,远程连接控制,以及LAMP环境安装配置,还做了部署DEMO演示。

下载

官网地址:http://mirrors.aliyun.com/ubuntu-releases/18.04/
这里选择桌面版:
image.png
下载完成之后:
image.png

安装

image.png
image.pngimage.png
image.png
image.pngimage.pngimage.png
然后就是等待安装完成:
image.png
安装完成登录:
image.png
登录成功:
image.png

设置ip地址

先切换到管理员:
image.png
在linux系统中:#表示超级管理员,$表示普通管理员
然后安装net-tools:
image.png
然后输入:ifconfig查看ip地址
image.png
目前这个是用的桥接模式,这个ip是动态的,是dhcp自动分配的,可以设置固定下来。
安装vim:
image.png
ip的设置在/etc/netplan目录,文件:01-network-manager-all.yaml
查看这个文件的默认内容:

root@ubuntu:/# cat /etc/netplan/01-network-manager-all.yaml 
# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager
root@ubuntu:/# 

将这个文件的内容修改为:

# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager
  ethernets:
    ens33:
      dhcp4: no
      addresses: [192.168.3.200/24]
      gateway4: 192.168.3.1
      nameservers:
        addresses: [192.168.3.1,61.139.2.69]

注意: gateway4 需要参考宿主机,还有dns也需要参考宿主机
image.png
:wq保存并退出。
测试执行:netplan try
image.png
执行:netplan apply应用即可。
这样,就算重启,ip也是固定的了。

远程连接

先执行:
在这里插入图片描述

发现没有监听22端口的程序。
那么需要安装ssh服务。
image.png
然后启动服务:
image.png
这里使用:finalShell进行远程操作
image.png
连接成功的样子:
image.png

安装lamp

更新软件源

image.png

安装apache

在这里插入图片描述

查看状态:

systemctl status apache2

image.png
直接浏览器访问:
image.png
相关命令:

# 启动apache
systemctl start apache2
# 停止apache
systemctl stop apache2
# 重启apache
systemctl restart apache2

通过欢迎页,可以看到网站的根在/var/www目录下
image.png

安装mysql57

输入:

apt-get install -y mysql-server

image.png
安装完成后,需要进行安全设置:照着填即可,密码为了方便记忆,直接设置 12345678

mysql_secure_installation

# 完整过程如下:
root@ubuntu:/# mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0
Please set the password for root here.

New password: 

Re-enter new password: 

Estimated strength of the password: 50 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n

 ... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : n

 ... skipping.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done! 
root@ubuntu:/# 

MySQL相关命令:

# 查看MySQL状态
systemctl status mysql
# 启动MySQL
systemctl start msyql
# 停止MySQL
systemctl stop mysql

登录MySQL试试
image.png
这个地方特别注意:还需要单独修改一下MySQL的密码
image.png
修改密码语句:

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '12345678';

改完之后:
image.png

安装PHP

ubuntu默认带的是PHP7.2的版本

 apt-get install -y php

接下来,我们需要告诉Apache首先提供PHP页面。
打开/etc/apache2/mods-enabled/dir.conf文件并将其更改为首先列出index.php。
原来是这样的:
image.png
改成这样:
image.png
重启apache :

systemctl restart apache2

在根目录下去创建一个phpinfo.php文件。

vim phpinfo.php

内容:

<?php
echo phpinfo();                 

保存,然后访问:
image.png
说明安装成功!
安装模块:
安装php模块很简单,直接输入如:即可安装成功。

apt install php-curl -y
apt install php-mysql -y
apt install php-mysqli -y

部署项目

直接将项目拷贝到/var/www/html里面即可。
这里简单部署一个开源的YzmCMS演示一下:
将在官网下载成功的压缩包上传到/var/www/html中:
image.png
上传上去之后:
image.png然后直接访问安装即可:
image.png
填写相关信息即可:
image.png
安装成功:
image.png

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Miracle_PHP|JAVA|安全

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值