June 25, 2022

karinfeller.com

my karin feller

Easy methods to set up Bazel on CentOS 8 Linux or Redhat 8/7

5 min read

Bazel is a construct software, a device that may run, bring together and take a look at to collect device, identical to Make, Ant, Gradle, Greenback, Pants, and Maven. Right here we will be able to see learn how to set up Bazel open-source device development and trying out software on CentOS 8 Linux / Movement / RHEL 8. 

What’s Bazel?

Bazel is a compilation software advanced by way of Google’s underneath its open-source initiative, and Bazel makes use of disbursed caching and incremental construct how to make compilation sooner. It natively helps the Java and C++ languages, and lately has open-source comparable laws for compiling Golang tasks.

Set up Bazel on CentOS or Redhat for development and trying out of device

    1. Open Command terminal on CentOS or RHEL. If you’re at the CLI server you then already on that, alternatively, for GUI, move to Actions, and from the menu, click on on Terminal icon.
    2. Login as Root or usual consumer with sudo get admission to.
    3. Upload Bazel repository on CentOS 8/7. And identical for the Redhat.For CentOS 7 or Redhat 7:
      yum config-manager --add-repo https://copr.fedorainfracloud.org/coprs/vbatts/bazel/repo/epel-7/vbatts-bazel-epel-7.repo

      For CentOS 8 Linux or RHEL 8:

      dnf config-manager --add-repo https://copr.fedorainfracloud.org/coprs/vbatts/bazel/repo/epel-8/vbatts-bazel-epel-8.repo
    4. Command to put in Bazel on CentOS
      dnf set up bazel

      or

      yum set up bazel

      Output for the command:

      [[email protected] ~]# dnf set up bazel
      Remaining metadata expiration test: 0:00:57 in the past on Sat 05 Oct 2019 09:49:22 AM EDT.
      Dependencies resolved.
      ===============================================================================================================
      Bundle Arch Model Repository Measurement
      ===============================================================================================================
      Putting in:
      bazel x86_64 0.29.1-0.el8 copr:copr.fedorainfracloud.org:vbatts:bazel 24 M
      Putting in dependencies:
      copy-jdk-configs noarch 3.7-1.el8 AppStream 27 okay
      java-11-openjdk x86_64 1:11.0.4.11-0.el8_0 AppStream 227 okay
      java-11-openjdk-devel x86_64 1:11.0.4.11-0.el8_0 AppStream 3.3 M
      java-11-openjdk-headless x86_64 1:11.0.4.11-0.el8_0 AppStream 39 M
      javapackages-filesystem noarch 5.3.0-1.module_el8.0.0+11+5b8c10bd
      AppStream 30 okay
      ttmkfdir x86_64 3.0.9-54.el8 AppStream 62 okay
      tzdata-java noarch 2019a-1.el8 AppStream 188 okay
      xorg-x11-fonts-Type1 noarch 7.5-19.el8 AppStream 522 okay
      lksctp-tools x86_64 1.0.18-3.el8 BaseOS 100 okay
      Enabling module streams:
      javapackages-runtime 201801
      
      Transaction Abstract
      ===============================================================================================================
      Set up 10 Programs
      
      General obtain dimension: 67 M
      Put in dimension: 205 M
      Is that this adequate [y/N]:
    5. Settle for the Uploading of Fedora COPR GPG key. Press Y key to simply accept it and proceed the Bazel set up procedure.Output:
      caution: /var/cache/dnf/copr:copr.fedorainfracloud.org:vbatts:bazel-df36dce8e0c0e1d6/applications/bazel-0.29.1-0.el8.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID eb2be214: NOKEY
      Copr repo for bazel owned by way of vbatts 285 B/s | 961 B 00:03
      Uploading GPG key 0xEB2BE214:
      Userid : "vbatts_bazel (None) <vbatts#[email protected]dorahosted.org>"
      Fingerprint: 090F 9C8B BDB6 3200 807E 16C2 978A 4B98 EB2B E214
      From : https://copr-be.cloud.fedoraproject.org/effects/vbatts/bazel/pubkey.gpg
      Is that this adequate [y/N]: y
      Key imported effectively
      Working transaction test
      Transaction test succeeded.
      Working transaction take a look at
      Transaction take a look at succeeded.
      Working transaction
      Working scriptlet: copy-jdk-configs-3.7-1.el8.noarch 1/1
      Working scriptlet: java-11-openjdk-headless-1:11.0.4.11-0.el8_0.x86_64 1/1
      Making ready : 1/1
      Putting in : lksctp-tools-1.0.18-3.el8.x86_64 1/10
      Working scriptlet: lksctp-tools-1.0.18-3.el8.x86_64 1/10
      Putting in : tzdata-java-2019a-1.el8.noarch 2/10
      Putting in : ttmkfdir-3.0.9-54.el8.x86_64 3/10
      Putting in : xorg-x11-fonts-Type1-7.5-19.el8.noarch 4/10
      Working scriptlet: xorg-x11-fonts-Type1-7.5-19.el8.noarch 4/10
      Putting in : javapackages-filesystem-5.3.0-1.module_el8.0.0+11+5b8c10bd.noarch 5/10
      Putting in : copy-jdk-configs-3.7-1.el8.noarch 6/10
      Putting in : java-11-openjdk-headless-1:11.0.4.11-0.el8_0.x86_64 7/10
      Working scriptlet: java-11-openjdk-headless-1:11.0.4.11-0.el8_0.x86_64 7/10
      Putting in : java-11-openjdk-1:11.0.4.11-0.el8_0.x86_64 8/10
      Working scriptlet: java-11-openjdk-1:11.0.4.11-0.el8_0.x86_64 8/10
      Putting in : java-11-openjdk-devel-1:11.0.4.11-0.el8_0.x86_64 9/10
      Working scriptlet: java-11-openjdk-devel-1:11.0.4.11-0.el8_0.x86_64 9/10
      Putting in : bazel-0.29.1-0.el8.x86_64 10/10
      Working scriptlet: copy-jdk-configs-3.7-1.el8.noarch 10/10
      Working scriptlet: java-11-openjdk-1:11.0.4.11-0.el8_0.x86_64 10/10
      Working scriptlet: java-11-openjdk-devel-1:11.0.4.11-0.el8_0.x86_64 10/10
      Working scriptlet: bazel-0.29.1-0.el8.x86_64 10/10
      Verifying : copy-jdk-configs-3.7-1.el8.noarch 1/10
      Verifying : java-11-openjdk-1:11.0.4.11-0.el8_0.x86_64 2/10
      Verifying : java-11-openjdk-devel-1:11.0.4.11-0.el8_0.x86_64 3/10
      Verifying : java-11-openjdk-headless-1:11.0.4.11-0.el8_0.x86_64 4/10
      Verifying : javapackages-filesystem-5.3.0-1.module_el8.0.0+11+5b8c10bd.noarch 5/10
      Verifying : ttmkfdir-3.0.9-54.el8.x86_64 6/10
      Verifying : tzdata-java-2019a-1.el8.noarch 7/10
      Verifying : xorg-x11-fonts-Type1-7.5-19.el8.noarch 8/10
      Verifying : lksctp-tools-1.0.18-3.el8.x86_64 9/10
      Verifying : bazel-0.29.1-0.el8.x86_64 10/10
      
      Put in:
      bazel-0.29.1-0.el8.x86_64
      copy-jdk-configs-3.7-1.el8.noarch
      java-11-openjdk-1:11.0.4.11-0.el8_0.x86_64
      java-11-openjdk-devel-1:11.0.4.11-0.el8_0.x86_64
      java-11-openjdk-headless-1:11.0.4.11-0.el8_0.x86_64
      javapackages-filesystem-5.3.0-1.module_el8.0.0+11+5b8c10bd.noarch
      ttmkfdir-3.0.9-54.el8.x86_64
      tzdata-java-2019a-1.el8.noarch
      xorg-x11-fonts-Type1-7.5-19.el8.noarch
      lksctp-tools-1.0.18-3.el8.x86_64
      
      Entire!
    6. Test Bazel put in Model
      bazel --version

      OutPut

      bazel 0.29.1
    7. The set up is a success. To start out development some fundamental venture, you’ll be able to see the legitimate educational web page.
See also  Is Linux In reality Extra Protected Than Home windows?

What’s particular about Bazel?

Bazel is a device building fashion designed to paintings with Google.

Has the next traits:

Multi-language toughen: Bazel helps Java, Function-C and C++, and can also be prolonged to toughen any programming language.

Prime-level construct language: Engineering is described by way of the BUILD language. The BUILD language describes a venture consisting of a couple of small interrelated libraries, binaries, and take a look at methods in a concise textual content layout. By contrast, instruments like Make want to describe particular person recordsdata and compiled instructions.

Multi-platform toughen: The similar set of instruments and the similar BUILD report can be utilized to construct device for various architectures and platforms. At Google, we use Bazel to construct server-side methods that run on our knowledge centre techniques and consumer packages that run on cell phones.

Reproducibility: In a BUILD report, every library, take a look at program, and binary will have to explicitly and explicitly specify direct dependencies. When the supply code report is changed, Bazel makes use of this dependency data to understand which of them will have to be rebuilt and which duties can also be done in parallel. Because of this all builds are incremental and will produce the similar effects every time.

Scalability: Bazel can take care of massive builds; at Google, a server-side program with greater than 100k of supply code is a not unusual factor. If no recordsdata are modified, the construct procedure takes about 200ms.

Why must I exploit Bazel?

Bazel can double the construct pace as it best recompiles recordsdata that want to be recompiled. In a similar fashion, it skips exams that experience no longer been modified.

See also  6 Steps to Safe Your Linux Server

It produces a made up our minds consequence. This gets rid of the variation in construct effects between incremental and blank builds, building machines, and steady integration.

Bazel can use the similar instruments underneath the similar venture to construct other consumer and server packages. As an example, you’ll be able to alter a shopper/server protocol in a devote after which take a look at that the up to date cellular and server-side methods paintings correctly, the use of the similar instruments when development, the use of the Bazel discussed above. feature.

Copyright © All rights reserved. | Newsphere by AF themes.