vm ubuntu设置中文
The purpose of this brief guide is to take you through the process of setting up a LAMP (Linux, Apache, MySQL, PHP) server on a local Ubuntu Linux machine or virtual machine.
本简要指南的目的是指导您完成在本地Ubuntu Linux机器或虚拟机上设置LAMP(Linux,Apache,MySQL,PHP)服务器的过程。
This will allow you to develop using PHP and MySQL (with phpMyAdmin). This is a common stack that is necessary for Wordpress development.
这将允许您使用PHP和MySQL(以及phpMyAdmin)进行开发。 这是Wordpress开发必需的通用堆栈。
安装必要的软件包 (Install the necessary packages)
You will need to install the following packages for the LAMP server. You can install them all at once by separating each package by a space, or one at a time like shown.
您将需要为LAMP服务器安装以下软件包。 您可以一次安装所有软件包,方法是将每个软件包隔开一个空格,或一次将一个软件包分开,如图所示。
I prefer to download one at a time because it is easier to see if there were any errors.
我更喜欢一次下载一个,因为它更容易查看是否有任何错误。
Enter the terminal and type the following:
输入终端并输入以下内容:
sudo apt-get install apache2
sudo apt-get install apache2
sudo apt-get install php
sudo apt-get install php
sudo apt-get install php-mysql
sudo apt-get install php-mysql
sudo apt-get install mysql-server
sudo apt-get install mysql-server
You should then be prompted to set a password for the MySQL root user. After setting the password continue to install:
然后,将提示您设置MySQL root用户的密码。 设置密码后,继续安装:
sudo apt-get install libapache2-mod-php
sudo apt-get install libapache2-mod-php
sudo apt-get install php-mcrypt
sudo apt-get install php-mcrypt
sudo apt-get install phpmyadmin
sudo apt-get install phpmyadmin
You should then be prompted which server to use. Select Apache by pressing enter. Select no for advanced server setup.
然后应提示您使用哪个服务器。 通过按Enter键选择Apache。 选择否进行高级服务器设置。
更改对/ var / www / html的权限 (Change permissions to the /var/www/html)
In order for PHP scripts and files to be run by the LAMP server they need to be saved in the /var/www/html directory. You can think of this location as your local server.
为了使LAMP服务器运行PHP脚本和文件,需要将它们保存在/ var / www / html目录中。 您可以将此位置视为本地服务器。
In order to make changes to this directory we need to change the permissions on it. In the terminal enter the command:
为了更改此目录,我们需要更改其权限。 在终端中输入命令:
sudo chown {your ubuntu username} /var/www/html
sudo chown {your ubuntu username} /var/www/html
创建一个指向phpMyAdmin的符号链接 (Create a symbolic link to phpMyAdmin)
By default, phpMyAdmin is installed in the /usr/share/ directory. We need to move it to our local server directory.
默认情况下,phpMyAdmin安装在/ usr / share /目录中。 我们需要将其移动到本地服务器目录。
We navigate to the server directory that we want the link in by: cd /var/www/html
我们通过以下方式导航到我们想要链接的服务器目录: cd /var/www/html
Then create the link by entering the command ln -s /usr/share/phpmyadmin phpmyadmin
.
然后通过输入命令ln -s /usr/share/phpmyadmin phpmyadmin
创建链接。
重新启动Apache并测试 (Restart Apache and test)
Run the following command to restart Apache, setting the changes that were made:
运行以下命令以重新启动Apache,并设置所做的更改:
sudo systemctl restart apache2
sudo systemctl restart apache2
You should then be able to create an info.php file in the /var/www/html directory with this command: touch /var/www/html/info.php
然后,您应该可以使用以下命令在/ var / www / html目录中创建一个info.php文件: touch /var/www/html/info.php
In the file type the following php code:
在文件中,输入以下php代码:
<?php phpinfo(); ?>
<?php phpinfo(); ?>
Then, open a browser and type in localhost/info.php You should see a page from the php file you just wrote that gives you information about php.
然后,打开浏览器并键入localhost / info.php。您应该看到刚刚编写的php文件中的页面,该页面为您提供有关php的信息。
Finally, to access phpMyAdmin go to localhost/phpmyadmin in your browser. The default root username is ‘root’ and the password is the password you chose earlier for the MySQL database.
最后,要访问phpMyAdmin,请在浏览器中访问localhost / phpmyadmin。 默认的根用户名是“ root”,密码是您先前为MySQL数据库选择的密码。
翻译自: https://www.freecodecamp.org/news/how-to-setup-a-lamp-server-on-a-local-ubuntu-linux-machine-or-vm/
vm ubuntu设置中文