search
HomePHP FrameworkLaravelDetailed explanation of the steps to install and run the laravel project on Homestead [Pictures and Text]

Although Homestead comes pre-installed with Nginx, PHP, MySQL, PostgreSQL, Redis, Memcached, Node, and all other software required to develop amazing Laravel applications, laravel still requires us to install it, so in Before reading this article, you need to set up a Homestead environment. It is recommended to study in combination with this article "The most comprehensive tutorial on setting up a Win10 Homestead environment [pictures and text]".

Tutorial on the steps to install and run the laravel project in Homestead:

Step 1: Connect the terminal to the virtual machine

  • First switch to the Homestead directory through the cd Homestead command;

  • Then use the vagrant ssh command to connect to the virtual machine. As shown in the figure below:

Detailed explanation of the steps to install and run the laravel project on Homestead [Pictures and Text]

Step 2: Change the composer source

Replace the composer domestic source , the command is as follows:

composer config -g repo.packagist composer 国内源地址
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

Detailed explanation of the steps to install and run the laravel project on Homestead [Pictures and Text]

##Note: The prerequisite for the second step is to install composer first. If it is not installed, please refer to " Installation and use of Composer under Windows/Linux (detailed explanation)

Step 3: Install the Laravel project

Enter the virtual machine server

/home/vagrant/code/ directory, then enter and execute the following command:

composer create-project --prefer-dist laravel/laravel marriage(项目名字)

Detailed explanation of the steps to install and run the laravel project on Homestead [Pictures and Text]

Then we can view the code synchronized with the virtual machine code under local Win10 The laravel project file has been successfully created in the marriage directory.

Note: Laravel’s main entry file is

public, which means that when we access the input domain name, we directly access the index in public .php.

Detailed explanation of the steps to install and run the laravel project on Homestead [Pictures and Text]

Step 4: Configure local and server synchronization

1. Modify

homestead.yamlFile, setting synchronization

As shown below, the site domain name set here is love.test, and the settings are synchronized to the project marriage:

folders:
    - map: C:\Users\Administrator\marriage\marriage
      to: /home/vagrant/code/marriage
sites:
    - map: love.test //你的域名
      to: /home/vagrant/code/marriage/public

Detailed explanation of the steps to install and run the laravel project on Homestead [Pictures and Text]

2. Configuration Virtual machine domain name and address IP mapping

  • First find the IP address corresponding to the virtual machine Homestead in the homestead.yaml file

Detailed explanation of the steps to install and run the laravel project on Homestead [Pictures and Text]

  • Then find and open the hosts file locally, add

    192.168.10.10 love.test, which means mapping this ip to love .testThis domain name.

Detailed explanation of the steps to install and run the laravel project on Homestead [Pictures and Text]

Step 5: Restart the service

Exit the server and execute the following command on the local cmd Restart vagrant and refresh the configuration:

vagrant reload --provision

Detailed explanation of the steps to install and run the laravel project on Homestead [Pictures and Text]

Step 6: Enter the domain name and visit

Enter the domain name in the address bar love.test to access, if the following content interface appears, it means that laravel is successfully installed

Detailed explanation of the steps to install and run the laravel project on Homestead [Pictures and Text]

Finally, you can do a small test to see if modifying the content locally can work Sync to the server.

As shown below, I modified the

welcome.blade.php file of the local laravel project, and you can see that it was successfully synchronized to the server~

Detailed explanation of the steps to install and run the laravel project on Homestead [Pictures and Text]

At this point, laravel has finally been installed successfully! ! !


The above is the detailed content of Detailed explanation of the steps to install and run the laravel project on Homestead [Pictures and Text]. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Beyond the Zoom Call: Creative Strategies for Connecting Distributed TeamsBeyond the Zoom Call: Creative Strategies for Connecting Distributed TeamsApr 26, 2025 am 12:24 AM

ToenhanceengagementandcohesionamongdistributedteamsbeyondZoom,implementthesestrategies:1)Organizevirtualcoffeebreaksforinformalchats,2)UseasynchronoustoolslikeSlackfornon-workdiscussions,3)Introducegamificationwithteamgamesorchallenges,and4)Encourage

What are the breaking changes in the latest Laravel version?What are the breaking changes in the latest Laravel version?Apr 26, 2025 am 12:23 AM

Laravel10introducesseveralbreakingchanges:1)ItrequiresPHP8.1orhigher,2)TheRouteServiceProvidernowusesabootmethodforloadingroutes,3)ThewithTimestamps()methodonEloquentrelationshipsisdeprecated,and4)TheRequestclassnowpreferstherules()methodforvalidatio

The Productivity Paradox: Maintaining Focus and Motivation in Remote SettingsThe Productivity Paradox: Maintaining Focus and Motivation in Remote SettingsApr 26, 2025 am 12:17 AM

Tomaintainfocusandmotivationinremotework,createastructuredenvironment,managedigitaldistractions,fostermotivationthroughsocialinteractionsandgoalsetting,maintainwork-lifebalance,anduseappropriatetechnology.1)Setupadedicatedworkspaceandsticktoaroutine.

Building Trust from Afar: Fostering Collaboration in Distributed EnvironmentsBuilding Trust from Afar: Fostering Collaboration in Distributed EnvironmentsApr 26, 2025 am 12:13 AM

Tofostercollaborationandtrustinremoteteams,implementthesestrategies:1)Establishregular,structuredcommunicationwithpersonalcheck-ins,2)Usecollaborativetoolsfortransparency,3)Recognizeandcelebrateachievements,and4)Fosteracultureoftrustandadaptability.

What are the key features of the latest Laravel version?What are the key features of the latest Laravel version?Apr 26, 2025 am 12:01 AM

Laravel's latest version of the main features include: 1. LaravelOctane improves application performance, 2. Improved model factory support relationships and state definitions, 3. Enhanced Artisan commands, 4. Improved error handling, 5. New Eloquent accessors and modifiers. These features significantly improve development efficiency and application performance, but need to be used with caution to avoid potential problems.

The Illusion of Inclusion: Addressing Isolation and Loneliness in Remote WorkThe Illusion of Inclusion: Addressing Isolation and Loneliness in Remote WorkApr 25, 2025 am 12:28 AM

Tocombatisolationandlonelinessinremotework,companiesshouldimplementregular,meaningfulinteractions,provideequalgrowthopportunities,andusetechnologyeffectively.1)Fostergenuineconnectionsthroughvirtualcoffeebreaksandpersonalsharing.2)Ensureremoteworkers

Laravel for Full-Stack Development: A Comprehensive GuideLaravel for Full-Stack Development: A Comprehensive GuideApr 25, 2025 am 12:27 AM

Laravelispopularforfull-stackdevelopmentbecauseitoffersaseamlessblendofbackendpowerandfrontendflexibility.1)Itsbackendcapabilities,likeEloquentORM,simplifydatabaseinteractions.2)TheBladetemplatingengineallowsforclean,dynamicHTMLtemplates.3)LaravelMix

Video Conferencing Showdown: Choosing the Right Platform for Remote MeetingsVideo Conferencing Showdown: Choosing the Right Platform for Remote MeetingsApr 25, 2025 am 12:26 AM

Key factors in choosing a video conferencing platform include user interface, security, and functionality. 1) The user interface should be intuitive, such as Zoom. 2) Security needs to be paid attention to, and Microsoft Teams provides end-to-end encryption. 3) Functions need to match requirements, GoogleMeet is suitable for short meetings, and CiscoWebex provides advanced collaboration tools.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools