virtualbox 5.1安装Ubuntu 17.10后的一些设置(启用root登录,nat切换桥接网络,启用ssh和ftp,安装php7.1和nginx)

直接将nat网络切换为桥接网络即可,不需要特别的设置;

安装网络工具,以便使用ifconfig 等

apt-get install net-tools

也可以直接使用 ip 命令代替 ifconfig,请参考这里:

Linux下新的网络管理工具ip替代ifconfig零压力 http://os.51cto.com/art/201508/488851.htm

 

开启root登录

https://jingyan.baidu.com/article/3c48dd34a5162be10be358bd.html

http://blog.csdn.net/sunxiaoju/article/details/51993091

1.sudo passwd root

2.进入/etc/pam.d/目录

在目录内修改两个文件

gdm-autologin

gdm-password

首先将两个文件的权限改成 777

sudo chmod 777 gdm-autologin

sudo chmod 777 gdm-password

修改文件之后使用Vim或是Gedit修改上面的两个文件使用 # 注释里面的

#auth   required   pam_succeed_if.so user != root quiet_success 部分

3.改回文件的原来的权限

sudo chmod 644 gdm-autologin

sudo chmod 644 gdm-password

我们现在重新启动Ubuntu 17.10,并在开机的时候选择 【未列出?】输入用户名 root ,及你第一步设置好的密码,好了现在你可以以Root登录了。

 

开启root,ssh,sftp登录(https://www.itisxx.com/wp-admin/post-new.php)

apt-get install openssh-server

或者 apt-get install ssh

vim /etc/ssh/sshd_config

找到# Authentication项下的PermitRootLogin prohibit-password改成PermitRootLogin yes

systemctl restart sshd (重启ssh)

 

UBuntu 双击运行 *.sh、*.py文件

http://www.cnblogs.com/jackchiang/p/4676984.html

 

安装PHP7.1和nginx (https://www.rosehosting.com/blog/install-php-7-1-with-nginx-on-an-ubuntu-16-04-vps/)

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

sudo apt-get install php7.1 php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-mysql php7.1-mbstring php7.1-mcrypt php7.1-zip php7.1-fpm php7.1-gd php7.1-redis php7.1-memcache php7.1-xml php7.1-curl

sudo vim /etc/php/7.1/cli/php.ini 修改 cgi.fix_pathinfo=0

sudo systemctl restart php7.1-fpm.service

 

sudo apt-get install nginx

sudo vim /etc/nginx/sites-available/example.com

 

server {
listen 80;
server_name example.com www.example.com;
root /var/www/example.com;
index index.php;

location / {
try_files $uri $uri/ =404;
}

location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
include snippets/fastcgi-php.conf;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

location ~ /\.ht {
deny all;
}
}

 

设置软连接

sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/example.com

测试

sudo nginx -t

重启

sudo systemctl restart nginx.service

加入启动项

sudo systemctl enable nginx.service
sudo systemctl enable php7.1-fpm.service

原文链接:https://www.hertzdance.com/blog/virtualbox-5-1-ubuntu-17-1,转载请注明出处。

0

评论0

请先
欢迎光临频率跳动资源网
显示验证码
没有账号?注册  忘记密码?