mirror of
https://github.com/dathere/de-intern-guide.git
synced 2025-12-19 08:39:25 +00:00
1 line
No EOL
13 KiB
JavaScript
1 line
No EOL
13 KiB
JavaScript
"use strict";(self.webpackChunkde_intern_tutorial=self.webpackChunkde_intern_tutorial||[]).push([[985],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var a=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,a,o=function(e,t){if(null==e)return{};var n,a,o={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=a.createContext({}),p=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=p(n),m=o,k=d["".concat(l,".").concat(m)]||d[m]||c[m]||r;return n?a.createElement(k,i(i({ref:t},u),{},{components:n})):a.createElement(k,i({ref:t},u))}));function k(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[d]="string"==typeof e?e:o,i[1]=s;for(var p=2;p<r;p++)i[p]=n[p];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}m.displayName="MDXCreateElement"},810:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>c,frontMatter:()=>r,metadata:()=>s,toc:()=>p});var a=n(7462),o=(n(7294),n(3905));const r={sidebar_position:4},i="\ud83d\udcca CKAN Setup",s={unversionedId:"onboarding/ckan-setup",id:"onboarding/ckan-setup",title:"\ud83d\udcca CKAN Setup",description:"In this section we'll go over how to install CKAN v2.11.3 and get it running on your Ubuntu VM.",source:"@site/docs/onboarding/ckan-setup.mdx",sourceDirName:"onboarding",slug:"/onboarding/ckan-setup",permalink:"/de-intern-guide/onboarding/ckan-setup",draft:!1,editUrl:"https://github.com/dathere/de-intern-guide/tree/main/docs/onboarding/ckan-setup.mdx",tags:[],version:"current",sidebarPosition:4,frontMatter:{sidebar_position:4},sidebar:"guideSidebar",previous:{title:"\u26a1 qsv Setup",permalink:"/de-intern-guide/onboarding/qsv-setup"},next:{title:"\ud83d\udcee DataPusher+ Setup",permalink:"/de-intern-guide/onboarding/datapusher-plus-setup"}},l={},p=[{value:"\ud83d\udcdd Written Tutorial",id:"-written-tutorial",level:2},{value:"Upgrade packages",id:"upgrade-packages",level:2},{value:"Set up SSH (optional)",id:"set-up-ssh-optional",level:2},{value:"Install Docker",id:"install-docker",level:2},{value:"Install <code>docker-compose</code>",id:"install-docker-compose",level:2},{value:"Download Ahoy and add to $PATH",id:"download-ahoy-and-add-to-path",level:2},{value:"Set up ckan-compose (provides you with PostgreSQL, Redis, and SOLR 9)",id:"set-up-ckan-compose-provides-you-with-postgresql-redis-and-solr-9",level:2},{value:"CKAN steps 1-4 with caveats",id:"ckan-steps-1-4-with-caveats",level:2},{value:"When restarting your server",id:"when-restarting-your-server",level:2},{value:"Learn More",id:"learn-more",level:2}],u={toc:p},d="wrapper";function c(e){let{components:t,...n}=e;return(0,o.kt)(d,(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"-ckan-setup"},"\ud83d\udcca CKAN Setup"),(0,o.kt)("p",null,"In this section we'll go over how to install ",(0,o.kt)("a",{parentName:"p",href:"https://ckan.org"},"CKAN")," v2.11.3 and get it running on your Ubuntu VM."),(0,o.kt)("h2",{id:"-written-tutorial"},"\ud83d\udcdd Written Tutorial"),(0,o.kt)("p",null,"Prerequisites:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"New installation of Ubuntu 22.04 (",(0,o.kt)("a",{parentName:"li",href:"/onboarding/ubuntu-vm-setup"},"virtual machine"),", VPS, local device, etc.) connected to the Internet.")),(0,o.kt)("p",null,"For these installation notes we'll assume the username in Ubuntu is ",(0,o.kt)("inlineCode",{parentName:"p"},"rzmk"),", so change it to yours when applicable."),(0,o.kt)("h2",{id:"upgrade-packages"},"Upgrade packages"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"sudo apt update -y && sudo apt upgrade -y\n")),(0,o.kt)("admonition",{title:"Can't paste commands into your VM terminal?",type:"info"},(0,o.kt)("p",{parentName:"admonition"},"If you're unable to paste text into the VM, you may either:"),(0,o.kt)("ul",{parentName:"admonition"},(0,o.kt)("li",{parentName:"ul"},"Search through the VM settings/configuration to enable copying/pasting text"),(0,o.kt)("li",{parentName:"ul"},"SSH into the VM and paste into your local terminal"))),(0,o.kt)("h2",{id:"set-up-ssh-optional"},"Set up SSH (optional)"),(0,o.kt)("p",null,"If you're using a VM then it may be easier when developing to SSH into the VM from a code editor such as VSCodium."),(0,o.kt)("p",null,"To enable SSH on the VM install ",(0,o.kt)("inlineCode",{parentName:"p"},"openssh-server"),", and to identify the VM IP address to use when using SSH install ",(0,o.kt)("inlineCode",{parentName:"p"},"net-tools"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"sudo apt install openssh-server net-tools -y\n")),(0,o.kt)("p",null,"Run the ",(0,o.kt)("inlineCode",{parentName:"p"},"ifconfig")," command to identify your IP address, then use SSH on your local device and code editor to access the environment:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"ssh rzmk@IPADDRESSHERE\n")),(0,o.kt)("h2",{id:"install-docker"},"Install Docker"),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"Notes for this section based on ",(0,o.kt)("a",{parentName:"p",href:"https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-22-04"},"https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-22-04"),".")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},'sudo apt update\nsudo apt install apt-transport-https ca-certificates curl software-properties-common -y\ncurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg\necho "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null\nsudo apt update\napt-cache policy docker-ce\nsudo apt install docker-ce -y\n')),(0,o.kt)("p",null,"Also add your user to the sudo group to run Docker without ",(0,o.kt)("inlineCode",{parentName:"p"},"sudo"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"sudo usermod -aG docker ${USER}\nsu - ${USER}\n")),(0,o.kt)("h2",{id:"install-docker-compose"},"Install ",(0,o.kt)("inlineCode",{parentName:"h2"},"docker-compose")),(0,o.kt)("p",null,"We use ",(0,o.kt)("inlineCode",{parentName:"p"},"docker-compose")," to set up and run ",(0,o.kt)("inlineCode",{parentName:"p"},"ckan-compose"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"sudo apt install docker-compose -y\n")),(0,o.kt)("h2",{id:"download-ahoy-and-add-to-path"},"Download Ahoy and add to $PATH"),(0,o.kt)("p",null,"We'll be using ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/tino097/ckan-compose"},"ckan-compose")," to handle the PostgreSQL, Redis, and SOLR setup. One of the prerequisites for using ckan-compose is installing ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/ahoy-cli/ahoy"},"Ahoy"),"."),(0,o.kt)("p",null,"Go to ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/ahoy-cli/ahoy/releases/latest"},"https://github.com/ahoy-cli/ahoy/releases/latest")," and download the ",(0,o.kt)("inlineCode",{parentName:"p"},"ahoy-bin-linux-amd64")," file and move it to your ",(0,o.kt)("inlineCode",{parentName:"p"},"$PATH")," named as ",(0,o.kt)("inlineCode",{parentName:"p"},"ahoy"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"sudo mv ~/Downloads/ahoy-bin-linux-amd64 /usr/local/bin/ahoy\nsudo chmod +x /usr/local/bin/ahoy\n")),(0,o.kt)("h2",{id:"set-up-ckan-compose-provides-you-with-postgresql-redis-and-solr-9"},"Set up ckan-compose (provides you with PostgreSQL, Redis, and SOLR 9)"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"cd ~/\nsudo apt install docker-compose -y\ngit clone https://github.com/tino097/ckan-compose.git\ncd ckan-compose\ngit switch solr-9-impl\nahoy generate-env\nahoy up\n")),(0,o.kt)("admonition",{title:"Apple Silicon?",type:"info"},(0,o.kt)("p",{parentName:"admonition"},"If you're using macOS, you may need to change the postgis image used in ",(0,o.kt)("inlineCode",{parentName:"p"},"ckan-compose/postgres/Dockerfile"),". Change ",(0,o.kt)("inlineCode",{parentName:"p"},"FROM postgis/postgis:16-3.4-alpine")," to FROM ",(0,o.kt)("inlineCode",{parentName:"p"},"imresamu/postgis:16-3.4-bundle0-bookworm")," (based on ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/dathere/de-intern-guide/issues/29"},"this issue"),").")),(0,o.kt)("admonition",{title:"Permission denied?",type:"info"},(0,o.kt)("p",{parentName:"admonition"},'If you get a "Permission denied" error, you may need to run ',(0,o.kt)("inlineCode",{parentName:"p"},"sudo ahoy up")," instead of ",(0,o.kt)("inlineCode",{parentName:"p"},"ahoy up"),".")),(0,o.kt)("p",null,"You may get asked after ",(0,o.kt)("inlineCode",{parentName:"p"},"ahoy generate-env")," to provide a ",(0,o.kt)("inlineCode",{parentName:"p"},"PROJECT_NAME"),", this can be anything so we'll put ",(0,o.kt)("inlineCode",{parentName:"p"},"myproject"),". You may also use the defaults for ",(0,o.kt)("inlineCode",{parentName:"p"},"DATASTORE_READONLY_PASSWORD")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"POSTGRES_PASSWORD")," for development."),(0,o.kt)("h2",{id:"ckan-steps-1-4-with-caveats"},"CKAN steps 1-4 with caveats"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"sudo apt-get install python3-dev libpq-dev python3-pip python3-venv git-core redis-server -y\nsudo mkdir -p /usr/lib/ckan/default\nsudo chown `whoami` /usr/lib/ckan/default\npython3 -m venv /usr/lib/ckan/default\n. /usr/lib/ckan/default/bin/activate\npip install --upgrade pip\npip install -e 'git+https://github.com/ckan/ckan.git@ckan-2.11.3#egg=ckan[requirements]'\ndeactivate\n. /usr/lib/ckan/default/bin/activate\nsudo mkdir -p /etc/ckan/default\nsudo chown -R `whoami` /etc/ckan/\nckan generate config /etc/ckan/default/ckan.ini\nln -s /usr/lib/ckan/default/src/ckan/who.ini /etc/ckan/default/who.ini\n")),(0,o.kt)("p",null,"Let's continue to step 7 while in the virtual environment (replace ",(0,o.kt)("inlineCode",{parentName:"p"},"rzmk")," with your group then username for the ",(0,o.kt)("inlineCode",{parentName:"p"},"chown")," command and your CKAN details for the CKAN sysadmin account generation command). You may be prompted to add a sysadmin username and password (the password should be at least 8 characters such as ",(0,o.kt)("inlineCode",{parentName:"p"},"password")," since we're using this instance for development locally and not exposing it to the Internet)."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"cd /usr/lib/ckan/default/src/ckan\npip install flask-debugtoolbar==0.14.1\ncd /var/lib\nsudo mkdir -p ckan/default\nsudo chown rzmk.rzmk ckan/default\nckan -c /etc/ckan/default/ckan.ini db init\nckan -c /etc/ckan/default/ckan.ini sysadmin add rzmk email=rzmk@localhost name=rzmk\nckan -c /etc/ckan/default/ckan.ini run\n")),(0,o.kt)("p",null,"Now you should be able to view your locally running CKAN instance at ",(0,o.kt)("a",{parentName:"p",href:"http://localhost:5000"},"http://localhost:5000"),"."),(0,o.kt)("h2",{id:"when-restarting-your-server"},"When restarting your server"),(0,o.kt)("p",null,"If you shut down your Ubuntu instance and then start it again, you may want to run the following commands to get the CKAN instance running again:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"/etc/init.d/redis-server stop\ncd ckan-compose\nahoy up\n")),(0,o.kt)("p",null,"Then run the following (e.g., after you SSH from your preferred terminal):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"cd /usr/lib/ckan/default/\n. ./bin/activate\ncd src/ckan\nckan -c /etc/ckan/default/ckan.ini run\n")),(0,o.kt)("h2",{id:"learn-more"},"Learn More"),(0,o.kt)("p",null,"Once you're up and running with CKAN, notify the team and you may also learn more about using CKAN on our ",(0,o.kt)("a",{parentName:"p",href:"https://support.dathere.com/support/solutions/154000118497"},"datHere CKAN DMS support page"),"."))}c.isMDXComponent=!0}}]); |