Linux小课堂开课了(5)
发布时间:2020-12-14 00:46:38 所属栏目:Linux 来源:网络整理
导读:1、 修改hostname主机名 查看一下hostname [ [email?protected] ~]# cat /etc/hostname localhost.localdomain [ [email?protected] ~]# vim /etc/hostname #永久生效 server0.example.com [ [email?protected] ~]# hostname test #临时生效,重启后失效 [ [
1、 修改hostname主机名
查看一下hostname [ [email?protected] ~]# cat /etc/hostname localhost.localdomain [ [email?protected] ~]# vim /etc/hostname #永久生效 server0.example.com [ [email?protected] ~]# hostname test #临时生效,重启后失效 [ [email?protected] ~]# hostname Test 2、 使用ssh远程连接主机 [ [email?protected] ~]# ssh [email?protected] The authenticity of host ‘192.168.11.137 (192.168.11.137)‘ can‘t be established. ECDSA key fingerprint is 70:50:c9:2b:f9:32:07:87:82:e7:38:53:27:b7:84:1d. Are you sure you want to continue connecting (yes/no)? ssh的端口是22,为了安全起见,应该更改端口 更改端口的方式 [ [email?protected] ~]# vim /etc/ssh/sshd_config Port 22 更改为其他端口 重启一下ssh服务 [ [email?protected] ~]# systemctl restart sshd [ [email?protected] ~]# systemctl enable sshd 可以验证是否更改成功 [ [email?protected] ~]# netstat -tlunp | grep sshd 3、 简单安装lamp 先安装apache [ [email?protected] ~]# yum -y install httpd 重启http服务 [ [email?protected] ~]# systemctl restart httpd [ [email?protected] ~]# systemctl enable httpd 浏览器输入IP进行测试 查看端口 [ [email?protected] ~]# netstat -anutp | grep 80 配置文件 [ [email?protected] ~]# vim /etc/httpd/conf/httpd.conf 安装数据库mariadb [ [email?protected] ~]# yum -y install mariadb mariadb-server 重启mariadb [ [email?protected] ~]# systemctl restart mariadb [ [email?protected] ~]# systemctl enable mariadb 安装php [ [email?protected] ~]# yum -y install php php-mysql 测试一下 [ [email?protected] ~]# cd /var/www/html [ [email?protected] html]# vim index.php <?php phpinfo(); ?> 浏览器输入ip 未完,待续~ (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |