zrok/assets/js/47881d5c.ae1dcb33.js
2023-11-29 17:20:59 +00:00

1 line
12 KiB
JavaScript

"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[826],{6285:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>h,contentTitle:()=>p,default:()=>g,frontMatter:()=>d,metadata:()=>u,toc:()=>m});var r=s(5893),t=s(1151),i=s(4908),a=s(3298),o=s(7597),l=s(1326),c=s(2753);const d={title:"Install zrok in Linux",sidebar_label:"Linux"},p=void 0,u={id:"guides/install/linux",title:"Install zrok in Linux",description:"Linux Binary",source:"@site/../docs/guides/install/linux.mdx",sourceDirName:"guides/install",slug:"/guides/install/linux",permalink:"/docs/guides/install/linux",draft:!1,unlisted:!1,editUrl:"https://github.com/openziti/zrok/blob/main/docs/../docs/guides/install/linux.mdx",tags:[],version:"current",frontMatter:{title:"Install zrok in Linux",sidebar_label:"Linux"},sidebar:"tutorialSidebar",previous:{title:"Install",permalink:"/docs/guides/install/"},next:{title:"macOS",permalink:"/docs/guides/install/macos"}},h={},m=[{value:"Linux Binary",id:"linux-binary",level:2},{value:"Install <code>zrok</code> from the Repository",id:"install-zrok-from-the-repository",level:2}];function x(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",li:"li",ol:"ol",p:"p",pre:"pre",...(0,t.a)(),...e.components},{Details:s}=n;return s||function(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Details",!0),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"linux-binary",children:"Linux Binary"}),"\n",(0,r.jsx)(i.N,{children:(0,r.jsx)("div",{className:o.Z.downloadContainer,children:(0,r.jsx)(a.Z,{osName:"Linux",osLogo:"/img/logo-linux.svg"})})}),"\n",(0,r.jsxs)(n.p,{children:["Download the binary distribution for your Linux distribution's architecture or run the install script below to pick the correct CPU architecture automatically. For Intel and AMD 64-bit machines use the ",(0,r.jsx)(n.code,{children:"amd64"})," distribution. For Raspberry Pi use the ",(0,r.jsx)(n.code,{children:"arm64"})," distribution."]}),"\n",(0,r.jsxs)(s,{children:[(0,r.jsxs)("summary",{children:["Manually install in ",(0,r.jsx)(n.code,{children:"~/bin/zrok"})]}),(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:"Unarchive the distribution in a temporary directory."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-text",children:"mkdir /tmp/zrok && tar -xf ./zrok*linux*.tar.gz -C /tmp/zrok\n"})}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Install the ",(0,r.jsx)(n.code,{children:"zrok"})," executable."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-text",children:"mkdir -p ~/bin && install /tmp/zrok/zrok ~/bin/\n"})}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Add ",(0,r.jsx)(n.code,{children:"~/bin"})," to your shell's executable search path. Optionally add this to your ~/.zshenv to persist the change."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-text",children:"PATH=~/bin:$PATH\n"})}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["With the ",(0,r.jsx)(n.code,{children:"zrok"})," executable in your path, you can then execute the ",(0,r.jsx)(n.code,{children:"zrok"})," command from your shell:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-text",children:"zrok version\n"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-buttonless",metastring:'title="Output"',children:" _ \n _____ __ ___ | | __\n|_ / '__/ _ \\| |/ /\n / /| | | (_) | < \n/___|_| \\___/|_|\\_\\\n\nv0.4.0 [c889005]\n"})}),"\n"]}),"\n"]})]}),"\n",(0,r.jsxs)(s,{children:[(0,r.jsxs)("summary",{children:["Script to install binary in ",(0,r.jsx)(n.code,{children:"/usr/local/bin/zrok"})]}),(0,r.jsx)(n.p,{children:"This script auto-selects the correct architecture, and may be helpful for Raspberry Pi users."}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-text",children:"(set -euo pipefail;\n\ncd $(mktemp -d);\n\nZROK_VERSION=$(\n curl -sSf https://api.github.com/repos/openziti/zrok/releases/latest \\\n | jq -r '.tag_name'\n);\n\ncase $(uname -m) in\n x86_64) GOXARCH=amd64 ;;\n aarch64|arm64) GOXARCH=arm64 ;;\n armv7|armhf|arm) GOXARCH=arm ;;\n *) echo \"ERROR: unknown arch '$(uname -m)'\" >&2\n exit 1 ;;\nesac;\n\ncurl -sSfL \\\n \"https://github.com/openziti/zrok/releases/download/${ZROK_VERSION}/zrok_${ZROK_VERSION#v}_linux_${GOXARCH}.tar.gz\" \\\n | tar -xz -f -;\n\nsudo install -o root -g root ./zrok /usr/local/bin/;\nzrok version;\n)\n"})})]}),"\n",(0,r.jsxs)(n.h2,{id:"install-zrok-from-the-repository",children:["Install ",(0,r.jsx)(n.code,{children:"zrok"})," from the Repository"]}),"\n",(0,r.jsxs)(n.p,{children:["We recommend that you install ",(0,r.jsx)(n.code,{children:"zrok"})," from the Linux package repository with the manual steps or the setup script. DEB and RPM packages are available for amd64, arm64, and armv7 architectures."]}),"\n",(0,r.jsx)(n.admonition,{type:"info",children:(0,r.jsxs)(n.p,{children:["Check out ",(0,r.jsx)(n.a,{href:"/docs/guides/frontdoor?os=Linux",children:"zrok frontdoor"})," for running ",(0,r.jsx)(n.code,{children:"zrok"})," as an always-on service."]})}),"\n",(0,r.jsxs)(s,{children:[(0,r.jsx)("summary",{children:"Manually set up DEB repository"}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-text",children:"(set -euo pipefail;\n\ncurl -sSLf https://get.openziti.io/tun/package-repos.gpg \\\n| sudo gpg --dearmor --output /usr/share/keyrings/openziti.gpg;\nsudo chmod a+r /usr/share/keyrings/openziti.gpg;\n\nsudo tee /etc/apt/sources.list.d/openziti-release.list >/dev/null <<EOF;\ndeb [signed-by=/usr/share/keyrings/openziti.gpg] https://packages.openziti.org/zitipax-openziti-deb-stable debian main\nEOF\n\nsudo apt update;\nsudo apt install zrok;\nzrok version;\n)\n"})})]}),"\n",(0,r.jsxs)(s,{children:[(0,r.jsx)("summary",{children:"Manually set up RPM repository"}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-text",children:"(set -euo pipefail;\n\nsudo tee /etc/yum.repos.d/openziti-release.repo >/dev/null <<\\EOF;\n[OpenZitiRelease]\nname=OpenZiti Release\nbaseurl=https://packages.openziti.org/zitipax-openziti-rpm-stable/redhat/$basearch\nenabled=1\ngpgcheck=0\ngpgkey=https://packages.openziti.org/zitipax-openziti-rpm-stable/redhat/$basearch/repodata/repomd.xml.key\nrepo_gpgcheck=1\nEOF\n\nsudo dnf update;\nsudo dnf install zrok;\nzrok version;\n)\n"})})]}),"\n",(0,r.jsxs)(s,{children:[(0,r.jsx)("summary",{children:"Script to set up DEB or RPM repository"}),(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:"Download the zrok install script."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-text",children:"curl -sSLfo ./zrok-install.bash https://get.openziti.io/install.bash\n"})}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:"Inspect the script to ensure it is suitable to run as root on your system."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-text",children:"less ./zrok-install.bash\n"})}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Run the script as root to add the package repo and install the ",(0,r.jsx)(n.code,{children:"zrok"})," package."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-text",children:"sudo bash ./zrok-install.bash zrok\n"})}),"\n"]}),"\n"]})]}),"\n",(0,r.jsxs)(s,{children:[(0,r.jsx)("summary",{children:"Ansible Playbook"}),(0,r.jsxs)(c.Z,{title:"Set up package repository and install zrok",children:[l.Z,"\n- name: Install zrok package\n gather_facts: false\n hosts: all \n become: true\n tasks:\n - name: Install zrok\n ansible.builtin.package:\n name: zrok\n state: present\n"]})]})]})}function g(e={}){const{wrapper:n}={...(0,t.a)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(x,{...e})}):x(e)}},4908:(e,n,s)=>{s.d(n,{L:()=>a,N:()=>o});var r=s(7294),t=s(5893);const i=(0,r.createContext)([]),a=()=>(0,r.useContext)(i),o=e=>{let{children:n}=e;const[s,a]=(0,r.useState)([]);return(0,r.useEffect)((()=>{(async()=>{try{const e=await fetch("https://api.github.com/repos/openziti/zrok/releases/latest");if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const n=(await e.json()).assets.map((e=>({name:e.name,url:e.browser_download_url,arch:e.name.replace(".tar.gz","").split("_")[3]})));console.log("Fetched assets:",n),a(n)}catch(e){console.error("Error fetching the release assets:",e)}})()}),[]),(0,t.jsx)(i.Provider,{value:s,children:n})}},2753:(e,n,s)=>{s.d(n,{Z:()=>a});s(7294);var r=s(1272),t=s(9286),i=s(5893);const a=e=>{let{title:n,children:s}=e;const a=s.map((e=>"string"==typeof e?e.trim():r.ZP.dump(e).trim())).join("\n\n");return(0,i.jsx)("div",{children:(0,i.jsx)(t.Z,{language:"yaml",title:n,children:a})})}},3298:(e,n,s)=>{s.d(n,{Z:()=>l});s(7294);var r=s(4908),t=s(7597),i=s(2949),a=s(5893);const o=e=>{switch(e){case"amd64":return"x86_64";case"arm64":return"ARM64";case"armv7":return"ARM";default:return e.toUpperCase()}},l=e=>{let{osName:n,osLogo:s,infoText:l,guideLink:c}=e;const{colorMode:d}=(0,i.I)(),p=(0,r.L)();console.log("Assets in DownloadCard:",p);const u=(e=>{switch(e){case"Windows":return"windows";case"macOS":return"darwin";case"Linux":return"linux";default:return""}})(n),h=p.filter((e=>e.name.includes(u)));return console.log("Filtered assets for",n,"in DownloadCard:",h),(0,a.jsxs)("div",{className:t.Z.downloadCard,children:[(0,a.jsx)("div",{className:t.Z.imgContainer,children:(0,a.jsx)("img",{src:s,alt:`${n} logo`})}),(0,a.jsx)("h3",{children:n}),h.length>0&&(0,a.jsx)("ul",{children:h.map(((e,n)=>(0,a.jsx)("li",{className:t.Z.downloadButtons,children:(0,a.jsx)("a",{href:e.url,className:t.Z.downloadLinks,children:o(e.arch)})},n)))}),c&&(0,a.jsxs)("div",{className:t.Z.cardFooter,children:[(0,a.jsx)("p",{children:l}),(0,a.jsx)("a",{href:c,children:"GUIDE"}),(0,a.jsx)("p",{})]})]})}},7597:(e,n,s)=>{s.d(n,{Z:()=>r});const r={downloadContainer:"downloadContainer_nNgj",downloadCard:"downloadCard_D_EY",cardFooter:"cardFooter_Rhom",downloadButtons:"downloadButtons_NPAP",downloadLinks:"downloadLinks_thSu",imgContainer:"imgContainer_r0QA"}},1326:(e,n,s)=>{s.d(n,{Z:()=>r});const r=[{name:"Set up zrok Package Repo",gather_facts:!0,hosts:"all",become:!0,tasks:[{name:"Set up apt repo",when:'ansible_os_family == "Debian"',block:[{name:"Install playbook dependencies","ansible.builtin.package":{name:["gnupg"],state:"present"}},{name:"Fetch armored pubkey","ansible.builtin.uri":{url:"https://get.openziti.io/tun/package-repos.gpg",return_content:"yes"},register:"armored_pubkey"},{name:"Dearmor pubkey","ansible.builtin.shell":'gpg --dearmor --output /usr/share/keyrings/openziti.gpg <<< "{{ armored_pubkey.content }}"\n',args:{creates:"/usr/share/keyrings/openziti.gpg",executable:"/bin/bash"}},{name:"Set pubkey filemode","ansible.builtin.file":{path:"/usr/share/keyrings/openziti.gpg",mode:"a+rX"}},{name:"Install OpenZiti repo deb source","ansible.builtin.copy":{dest:"/etc/apt/sources.list.d/openziti-release.list",content:"deb [signed-by=/usr/share/keyrings/openziti.gpg] https://packages.openziti.org/zitipax-openziti-deb-stable debian main\n"}},{name:"Refresh Repo Sources","ansible.builtin.apt":{update_cache:"yes",cache_valid_time:3600}}]},{name:"Set up yum repo",when:'ansible_os_family == "RedHat"',block:[{name:"Install OpenZiti repo rpm source","ansible.builtin.yum_repository":{name:"OpenZitiRelease",description:"OpenZiti Release",baseurl:"https://packages.openziti.org/zitipax-openziti-rpm-stable/redhat/$basearch",enabled:"yes",gpgkey:"https://packages.openziti.org/zitipax-openziti-rpm-stable/redhat/$basearch/repodata/repomd.xml.key",repo_gpgcheck:"yes",gpgcheck:"no"}}]}]}]}}]);