How to compile and install the Go language source code of AnQiCMS, what are the required environment dependencies?

Calendar 👁️ 74

As an experienced website operation expert, I am willing to elaborate in detail on the steps of compiling and installing AnQiCMS (AnQiCMS) Go language source code and the required environment dependencies.AnQi CMS, with its excellent gene of Go language, provides high-performance, high-concurrency content management capabilities. For advanced users who want to deeply customize or deploy in specific environments, source code compilation is undoubtedly an ideal choice.

Deeply analyze AnQiCMS Go language source code compilation: environment dependencies and step-by-step installation guide

AnQi CMS, this enterprise-level content management system meticulously crafted based on the Go language, with its excellent performance, strong customizability, and outstanding scalability, has become the preferred tool for many small and medium-sized enterprises and content operation teams.It not only provides efficient content publishing and management, but also performs well in SEO optimization, multi-site support, and other aspects.For users who want to deeply understand the underlying mechanism of AnQiCMS or need to carry out in-depth secondary development according to their own business characteristics, compiling and installing from the source code is undoubtedly a way.

Although the official version provides a convenient binary version and Docker deployment method, compiling from source code allows you to have complete control over the system, meet the needs of non-standard deployment, or even for developers to learn about the construction of Go language projects.Let's uncover the mystery of AnQiCMS source code compilation step by step.

1. Environment dependencies: building the foundation for compilation

Before compiling the AnQiCMS source code, we need to ensure that your system is ready with the following core environment components. These are necessary conditions for the successful compilation and operation of AnQiCMS and cannot be missing.

  1. Go language environment (GoLang):The core of AnQiCMS is Go language, therefore, your system must install the Go language development environment. According to the requirements of AnQiCMS, you need to installGo 1.13 or higher version. The Go website provides detailed installation guides and packages for all platforms (Windows, Linux, MacOS), please be sure to refer to the installation.After installation, you can enter in the command linego versionVerify that the Go environment is configured correctly and check the current version of Go.

  2. MySQL database:AnQiCMS's data storage depends on MySQL. Therefore, you need to installMySQL version 5.6.35 or higherThe database service. Whether it is for local testing or production environment, a stable running MySQL instance is essential.After installing and starting the MySQL service, please ensure you have a database user with sufficient privileges to create and manage data tables for AnQiCMS.Generally, you need to remember the root user password of MySQL, or create a dedicated user and database for AnQiCMS.

Please note that the two environment dependencies mentioned above are prerequisites for source code compilation. The document explicitly states that the source code compilation process assumes that you have already installed and configured these two software packages.

Second, the source code compilation and installation steps: step by step

With a stable compilation environment, we can start the source code compilation journey of AnQiCMS.The entire process can be divided into several stages such as obtaining the source code, configuring the Go module, compiling the execution file, and starting the test.

  1. Get the source code of AnQiCMS: First, you need to clone the source code of the project from AnQiCMS's official GitHub repository to your local machine. Open your terminal or command line tool and execute the following command:

    git clone https://github.com/fesiong/goblog.git
    cd goblog
    

    Please note that according to the document, the GitHub repository name of the project isgoblogbut it corresponds to the source code of AnQiCMS. After cloning is complete, usecd goblogCommand enters the root directory of the project, all subsequent operations will be performed in this directory.

  2. Configure Go module proxy and download dependencies:To ensure that the Go module (Go Modules) can smoothly download all dependency libraries, especially under certain network conditions, we usually configure a Go proxy. Run the following command in the root directory of the project:

    go env -w GOPROXY=https://goproxy.cn,direct
    

    This command sets the proxy for Go modules, improving the success rate of dependency downloads. After setting up the proxy, the next step is to download and organize the Go module dependencies required for the project:

    go mod tidy
    go mod vendor
    

    go mod tidyUsed to clean and synchronize module dependencies, ensurego.modThe file is correct.go mod vendorAll project dependencies will be copied to the project root directory.vendorIn the folder, so that it can also be compiled without an internet connection, or to ensure consistency in a specific build environment.

  3. First run AnQiCMS (test mode):Before compiling and generating the executable file, you can first test whether AnQiCMS can run normally through thego runcommand. This is very useful for quickly verifying the environment and code:

    go run kandaoni.com/anqicms/main
    

    If everything goes well, the AnQiCMS service will be running locally,8001and you can access it through the browser at this time,https://en.anqicms.comto view the front-end page and go throughhttps://en.anqicms.com/system/Access the back-end management interface. This will help you confirm that all dependencies and configurations are in place before the official compilation.

  4. Generate executable files specific to the platform:After the test run is successful, you can compile the final executable file according to your target operating system:

    • Compile for Linux system:Under Linux, AnQiCMS provides a simplified compilation method. Just execute in the project root directory,makeCommand:

      make
      

      This command will automatically handle the compilation process and create a directory namedreleaseThe folder contains the executable files of AnQiCMS and other necessary files (such as template files, etc.), which can be used directly for deployment.

    • Windows system compilation:If you want to generate an executable file on Windows system, you can use the following command:

      go build -ldflags '-w -s -H=windowsgui' -o ./anqicms.exe kandaoni.com/anqicms/main
      

      This command will generate an executable namedanqicms.exein the current directory.-ldflagsparameter is used to optimize the size of the generated file and hide the command prompt window.

    • for compiling on MacOS system:For MacOS users, the compilation command is as follows:

      go build -ldflags '-w -s' -o ./anqicms kandaoni.com/anqicms/main
      

      After execution, a file named will be generated in the current directoryanqicmsin the current directory.

  5. To start and access:After compilation is complete:

    • InLinux systemOn, you will findreleaseContains in the directorystart.shandstop.shScript. You can execute by./start.shTo start the AnQiCMS service through./stop.shTo stop the service.
    • InWindows systemClick on the generatedanqicms.exefile to start the service.
    • First visithttps://en.anqicms.comAt this time, AnQiCMS will guide you to the initial installation interface, where you need to enter MySQL database information, set the background administrator account and password. After the settings are completed, you can accesshttps://en.anqicms.comAccess the website frontend and proceedhttps://en.anqicms.com/system/Access the backend management. If an initial installation has not been performed, the system provides a default administrator accountadminPassword,123456.

By following these steps, you have successfully compiled and run AnQiCMS from source, gaining access to its powerful

Related articles

How to configure Nginx reverse proxy after installing AnQiCMS via command line to access through port 80?

AnQiCMS is an enterprise-level content management system developed based on the Go language, which is favored by an increasing number of small and medium-sized enterprises and content operation teams due to its high efficiency, security, and ease of deployment.Under Linux, after installing AnQiCMS via the command line, we usually find that it runs on a specific port like `8001` by default.

2025-11-06

How to deploy AnQiCMS on a Linux server without a graphical panel in a command-line environment?

In the wave of digitalization, an efficient and stable content management system (CMS) is an indispensable foundation for both enterprises and individuals to operate websites.AnQiCMS (AnQiCMS) is an enterprise-level CMS developed based on the Go language, which has won good reputation in the industry with its excellent performance, security, and flexible scalability.It is particularly suitable for users who pursue lightweight, efficient, and customizable solutions, whether it is for small and medium-sized enterprises, self-media, or multi-site administrators.

2025-11-06

What are the precautions to be taken when configuring Nginx pseudo-static for AnQiCMS multi-site on the Baota panel?

As an experienced website operations expert, I am well aware of the importance of Nginx pseudo-static configuration for improving user experience and search engine optimization (SEO), especially in a powerful, multi-site management system like AnQiCMS.Static URL rewriting not only makes the URL look more concise and readable, but also makes it more friendly for search engine spiders to crawl and index the content, thus bringing better rankings.

2025-11-06

How to set the root directory and database name of a new site when adding AnQiCMS multi-site via Baota panel to avoid conflicts?

As an experienced website operations expert, I know that how to deploy multiple websites efficiently and without conflict is the key to success.AnQiCMS (AnQiCMS) provides us with great convenience with its excellent multi-site management capabilities.Today, let's delve into how to cleverly set the root directory and database name of a new site when deploying AnQiCMS multi-site with Baota panel, in order to avoid annoying conflicts and ensure that each site can run independently and stably.The strength of AnQi CMS lies in its ability to utilize a simple and efficient system architecture

2025-11-06

How to test and run AnQiCMS on Windows system for local development and debugging?

As an experienced website operations expert, I fully understand the importance of setting up a development environment locally.It not only allows you to safely test new features and adjust page layouts, but also accelerates content creation and feature iteration without affecting the online website.Today, let's delve deeply into how to easily set up and test run AnQiCMS on a Windows system, and embark on your local development and debugging journey.

2025-11-06

How to correctly stop or close the AnQiCMS application under Windows?

As an experienced website operations expert, I fully understand that in managing a content system, it is not only important to be proficient in using various functions, but also to maintain and manage the application on a daily basis.AnQiCMS (AnQi CMS) brings us a convenient user experience with its efficient and lightweight features based on the Go language in the Windows environment.However, whether for the need of maintenance, upgrade, or temporary debugging, we need to know how to properly and safely stop or close the AnQiCMS application.

2025-11-06

What is the specific method for installing and testing AnQiCMS under MacOS?

As an experienced website operations expert, I fully understand the importance of an efficient and stable content management system (CMS) for a corporate website.AnQiCMS (AnQiCMS) stands out in the field of small and medium-sized enterprises and content operations with its lightweight and efficient features in the Go language.Today, let's delve into how to easily install and test AnQiCMS on our commonly used MacOS system, so that everyone can better understand and use this excellent CMS.

2025-11-06

How to solve the error 'Port is occupied' during the installation of AnQiCMS?

AnQiCMS as an efficient and flexible content management system, is favored by many users for its lightweight characteristics of the Go language and ease of deployment.However, during the installation or startup of AnQiCMS, you may encounter a little surprise - an error message indicating that the port is already in use.Don't worry, this is usually a common and easy problem to solve.As an experienced website operations expert, I will delve into this issue for you and provide a clear and practical solution to help you smoothly build the AnQiCMS site.

2025-11-06