运行 Ubuntu 14.04 控制台上的 Vagrant
Running Vagrant on Ubuntu 14.04 console
是否可以在 Ubuntu 14.04 上 运行 Vagrant 虚拟机?
我了解此特定 VPS 服务器上的 SSH 上没有 GUI,因此我认为这就是我收到以下错误的原因:
The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'poweroff' state. Please verify everything is configured
properly and try again.
If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run `vagrant up` while the
VirtualBox GUI is open.
The primary issue for this error is that the provider you're using
is not properly configured. This is very rarely a Vagrant issue.
问题是我之前使用 Laravel Homestead 在带有 VirtualBox 和 Vagrant 的 Windows 机器虚拟机上;我目前正在寻找将其移动到 VPS。
我应该完全忽略虚拟机还是应该以其他方式创建一个盒子? (是否可能)
根据讨论,这些是在 uBuntu 上安装 Laravel 5 的以下步骤。
假设您没有 PHP 5,这些是安装它的步骤:
$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get install -y php5.6 php5.6-mcrypt php5.6-gd
如果您没有安装 apache2:
$ apt-get install apache2 libapache2-mod-php5
如果您没有安装 MYSQL:
$ apt-get install mysql-server php5.6-mysql
Laravel 必须安装 composer,需要互联网连接:
$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer
$ sudo chmod +x /usr/local/bin/composer
安装GIT:
$ apt-get install git
为 Laravel 启用 mbstring 扩展:
安装Laravel 5:
$ cd /var/www
$ git clone https://github.com/laravel/laravel.git
导航到 Laravel 代码目录并使用 composer 安装 Laravel 框架所需的所有依赖项。
$ cd /var/www/laravel
$ sudo composer install
依赖项安装需要一些时间。在对文件设置适当的权限之后。
$ chown -R www-data.www-data /var/www/laravel
$ chmod -R 755 /var/www/laravel
$ chmod -R 777 /var/www/laravel/app/storage
现在您必须设置加密密钥:
现在设置 Illuminate 加密服务使用的 32 位长随机数加密密钥。
$ php artisan key:generate
Application key [uOHTNu3Au1Kt7Uloyr2Py9blU0J5XQ75] set successfully.
现在编辑 config/app.php 配置文件并更新上面生成的应用程序密钥,如下所示。还要确保密码设置正确。
'key' => env('APP_KEY', 'uOHTNu3Au1Kt7Uloyr2Py9blU0J5XQ75'),
'cipher' => 'AES-256-CBC',
下一步是创建 Apache VirtualHost
现在在您的 Apache 配置文件中添加一个虚拟主机,以便从 Web 浏览器访问 Laravel 框架。在 /etc/apache2/sites-available/
目录下创建 Apache 配置文件并添加以下内容。
$ nano /etc/apache2/sites-available/laravel.example.com.conf
您需要成为根用户或超级用户才能编辑它
ServerName laravel.example.com
DocumentRoot /var/www/laravel/public
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/laravel>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
完成后,按 CTRL+X
并输入 Y
并按 Enter
最后让我们使用以下命令启用网站并重新加载 Apache 服务。
$ a2ensite laravel.example.com
$ sudo service apache2 reload
最后一步:
正在访问laravel
$ sudo echo "127.0.0.1 laravel.example.com" >> /etc/hosts
然后在您最喜欢的网络浏览器中访问 http://laravel.example.com
,如下所示。
在您的情况下,您将网站移动到 /var/www/
,您已经可以查看它了。
您也可以在 Laravel 目录中 CHOWN
Vagrant。
是否可以在 Ubuntu 14.04 上 运行 Vagrant 虚拟机? 我了解此特定 VPS 服务器上的 SSH 上没有 GUI,因此我认为这就是我收到以下错误的原因:
The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'poweroff' state. Please verify everything is configured
properly and try again.
If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run `vagrant up` while the
VirtualBox GUI is open.
The primary issue for this error is that the provider you're using
is not properly configured. This is very rarely a Vagrant issue.
问题是我之前使用 Laravel Homestead 在带有 VirtualBox 和 Vagrant 的 Windows 机器虚拟机上;我目前正在寻找将其移动到 VPS。 我应该完全忽略虚拟机还是应该以其他方式创建一个盒子? (是否可能)
根据讨论,这些是在 uBuntu 上安装 Laravel 5 的以下步骤。
假设您没有 PHP 5,这些是安装它的步骤:
$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get install -y php5.6 php5.6-mcrypt php5.6-gd
如果您没有安装 apache2:
$ apt-get install apache2 libapache2-mod-php5
如果您没有安装 MYSQL:
$ apt-get install mysql-server php5.6-mysql
Laravel 必须安装 composer,需要互联网连接:
$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer
$ sudo chmod +x /usr/local/bin/composer
安装GIT:
$ apt-get install git
为 Laravel 启用 mbstring 扩展:
安装Laravel 5:
$ cd /var/www
$ git clone https://github.com/laravel/laravel.git
导航到 Laravel 代码目录并使用 composer 安装 Laravel 框架所需的所有依赖项。
$ cd /var/www/laravel
$ sudo composer install
依赖项安装需要一些时间。在对文件设置适当的权限之后。
$ chown -R www-data.www-data /var/www/laravel
$ chmod -R 755 /var/www/laravel
$ chmod -R 777 /var/www/laravel/app/storage
现在您必须设置加密密钥:
现在设置 Illuminate 加密服务使用的 32 位长随机数加密密钥。
$ php artisan key:generate
Application key [uOHTNu3Au1Kt7Uloyr2Py9blU0J5XQ75] set successfully.
现在编辑 config/app.php 配置文件并更新上面生成的应用程序密钥,如下所示。还要确保密码设置正确。
'key' => env('APP_KEY', 'uOHTNu3Au1Kt7Uloyr2Py9blU0J5XQ75'),
'cipher' => 'AES-256-CBC',
下一步是创建 Apache VirtualHost
现在在您的 Apache 配置文件中添加一个虚拟主机,以便从 Web 浏览器访问 Laravel 框架。在 /etc/apache2/sites-available/
目录下创建 Apache 配置文件并添加以下内容。
$ nano /etc/apache2/sites-available/laravel.example.com.conf
您需要成为根用户或超级用户才能编辑它
ServerName laravel.example.com
DocumentRoot /var/www/laravel/public
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/laravel>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
完成后,按 CTRL+X
并输入 Y
并按 Enter
最后让我们使用以下命令启用网站并重新加载 Apache 服务。
$ a2ensite laravel.example.com
$ sudo service apache2 reload
最后一步:
正在访问laravel
$ sudo echo "127.0.0.1 laravel.example.com" >> /etc/hosts
然后在您最喜欢的网络浏览器中访问 http://laravel.example.com
,如下所示。
在您的情况下,您将网站移动到 /var/www/
,您已经可以查看它了。
您也可以在 Laravel 目录中 CHOWN
Vagrant。