Create an environment for creating websites on Windows

Let's first create an environment for creating a website on Windows.

The explanation is based on the assumption of "Windows 10 64bit", but it will be configured to work on Windows 8 and Windows 7 32bit (planned).

Creating an environment can be difficult at first.

If you follow the procedure, you can create an environment, so you can leave it unclear at first.

Here, I will explain up to the point of completing the blog.

You can create the following blog.

Websites created with Giblog are created using the same procedure.

These sites are blogs, but don't worry, it's easy if you want to create a regular website.

Perl Zemi Twitter, if you tell me that this isn't working, I'll answer.

Now let's move on to building the environment.

Install msys2 on Windows

First, install a tool called msys2 on Windows.

msys2 screen

What is this pitch-black screen? I'm a little surprised.

To explain a little, I will create a website by typing characters called commands on this black screen.

If you want to create a blog

giblog new_blog mysite

If you want to create a simple website

giblog new_website mysite

Run the above command to complete your website. The above command is written in Perl and will create an environment to execute it.

You can think of msys2 as a tool for executing commands like the one above.

I think it says "What is a command?", But it's okay now.

10 minutes to install msys2

Download and install msys2.

Download msys2

Let's install msys2. Use the 64-bit version of msys2 for 64-bit Windows, and the 32-bit version of msys2 for 32-bit Windows.

How to check ( Windows 7, Windows 8, Windows 10 >)

Download msys2.

At the top is the latest version. Click to download msys2 to your desktop.

Confirm user name

Make sure that the user directory under "C: \ Users" (Japanese display is C: \ users) in Windows is in English as shown below.

kimot

If it is in Japanese as shown below, additional settings are required.

Kimoto

If it is in Japanese, before installing msys2, set the variable name to "HOME" and the variable value to "C: \ msys64 \ home \ msys2user" in the environment variable settings. .. If it was in English, skip the steps below.

variable name variable value
HOME C: \ msys64 \ home \ msys2user

For a 32-bit environment, set as follows.

variable name variable value
HOME C: \ msys32 \ home \ msys2user

Please refer to the following for the procedure.

The above directory is set as the home directory of msys2.

A directory called "msys2user"

Install msys2

Double-click the msys2 icon on your desktop.

Press Next to start the installation. It will take about 3 minutes, so let's wait.

When you press Finish, msys2 will start, but let's press the cross on the upper right to end it.

The second and subsequent boots of msys2

Once you close msys2, you're wondering where to start next.

If you look for the table of contents of m from the list of applications in the Windows Start-Menu, you will find the directory "MSYS2 64bit".

In it

  • MSYS2 MinGW 64bit
  • MSYS2 MINGW 32bit
  • MSYS2 MSYS

However, let's start "MSYS2 MSYS" . There are three types of startup scripts in msys2, but in this case creating a website in Perl, select "MSYS2 MSYS".

Please note that if you make a mistake, the Perl environment will not be set up correctly.

The other two seem to be used when developing Windows native apps.

It is convenient to start by creating a shortcut on the desktop. In that case, right-click, "Other", "Open File Location", "Right-click" and "Copy" "MSYS2 MSYS", and then "Paste" on the desktop.

thank you for your hard work. Installation of msys2 is complete.

Next, on a black screen, execute commands to create an environment where Perl can be executed. After that, it's half.

Perl environment construction 20 minutes

Make Perl available on msys2. Let's install Perl and the list of development environments required by Perl together.

pacman -S perl perl-CPAN msys2-devel make libcrypt-devel git

Copy the above and select "Right click"->"Paste" in msys2 to paste it. Press Enter to execute the above command.

You will be asked if you want to install it, so press "Enter" to proceed. No matter what you ask, just press "Enter".

The following will be installed. This is the minimum environment required for Perl to work properly.

  • perl (perl)
  • cpan (perl-CPAN)
  • gcc (msys2-devel)
  • make (make)
  • crypt.h (libcrypt-devel)

pacman is a package manager for msys2. Package manager is a tool provided for installing and managing tools for creating an environment.

Now press the cross on the upper right once to close the terminal and restart "MSYS2 MSYS". If you don't do this, your PATH settings will be incorrect and the cpan command will not work properly.

Make sure you have Perl installed.

perl -v

If you see the following, it is installed. The version may be new.

This is perl 5, version 24, subversion 4 (v5.24.4) built for x86_64-msys-thread-multi

Website creation tool

Install the Perl libraries "Giblog" and "Mojolicious" as website creation tools.

Some Perl libraries are expected to work in Unix / Linux environments. Make sure the symbolic link works properly on msys2 with the following settings.

export MSYS = winsymlinks

Copy and paste the above and press Enter.

Then install the Perl library with the following command.

cpan Giblog
cpan Mojolicious

The first time you'll be asked if you want to set cpan automatically, press Enter to proceed. No matter what you ask, just press "Enter".

If this installation is confirmed, the environment construction work is completed.

Creating a website

I'm finally here. Finally, let's create a website.

You can create a website with the following command.

If you want to create a blog

giblog new_blog mysite

If you want to create a simple website

giblog new_website mysite

After creating a website, the created web siteLet's check it from your browser.

You can see the website with the following command.

cd ~ / mysite
morbo serve.pl

When you run the command, you should see something like this:

Server available at http://127.0.0.1:3000

In the address field of a web browser such as Internet Explorer, Firefox or Chrome

http://127.0.0.1:3000

Please enter.

I was able to confirm the created blog.

Congratulations!

After this, you can edit the site and add articles.

Troubleshooting

If the msys2 installation or Perl installation procedure fails, the virus checker (Avast, McAfee, Norton, etc.) may falsely detect msys2 as virus software.

Also, depending on the virus checker, it may not be possible to execute with administrator privileges.

If you encounter this issue, temporarily stop the virus checker and right-click "Run as administrator" before launching the msys2 installer.

If you are using Windows 10, you can install it without any problem by using the default virus software, Windows Defender.

Please

msys2 is updated regularly and the package name and update command change, so if this procedure doesn't work, repository Please let us know on a> or Perl Zemi Twitter.