Linux小課堂開課了(5)

一、 修改hostname主機名
查看一下hostname
[root@localhost ~]# cat /etc/hostname
localhost.localdomain
[root@localhost ~]# vim /etc/hostname #永久生效
server0.example.com
[root@localhost ~]# hostname test #臨時生效,重啓後失效
[root@localhost ~]# hostname
Test
二、 使用ssh遠程鏈接主機
[root@localhost ~]# ssh root@192.168.11.137
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,爲了安全起見,應該更改端口
更改端口的方式
[root@localhost ~]# vim /etc/ssh/sshd_config
Port 22 更改成其餘端口
重啓一下ssh服務
[root@localhost ~]# systemctl restart sshd
[root@localhost ~]# systemctl enable sshd
能夠驗證是否更改爲功
[root@localhost ~]# netstat -tlunp | grep sshd
三、 簡單安裝lamp
先安裝apache
[root@localhost ~]# yum -y install httpd
重啓http服務
[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# systemctl enable httpd
瀏覽器輸入IP進行測試
Linux小課堂開課了(5)
查看端口
[root@localhost ~]# netstat -anutp | grep 80
配置文件
[root@localhost ~]# vim /etc/httpd/conf/httpd.conf
安裝數據庫mariadb
[root@localhost ~]# yum -y install mariadb mariadb-server
重啓mariadb
[root@localhost ~]# systemctl restart mariadb
[root@localhost ~]# systemctl enable mariadb
安裝php
[root@localhost ~]# yum -y install php php-mysql
測試一下
[root@localhost ~]# cd /var/www/html
[root@localhost html]# vim index.php
<?php
phpinfo();
?>
瀏覽器輸入ipphp

Linux小課堂開課了(5)

未完,待續~html

相關文章
相關標籤/搜索