github.com/droot/goreleaser@v0.66.2-0.20180420030140-c2db5fb17157/docs/100-linux-packages.md (about) 1 --- 2 title: Linux Packages 3 --- 4 5 GoReleaser can generate RPM, Deb and Snap packages for your projects. 6 7 Let's see each option in detail: 8 9 ## NFPM 10 11 GoReleaser can be wired to [nfpm](https://github.com/goreleaser/nfpm) to 12 generate and publish `.deb` and `.rpm` packages. 13 14 Available options: 15 16 ```yml 17 # .goreleaser.yml 18 nfpm: 19 # You can change the name of the package. 20 # This is parsed with the Go template engine and the following variables 21 # are available: 22 # - ProjectName 23 # - Tag 24 # - Version (Git tag without `v` prefix) 25 # - Os 26 # - Arch 27 # - Arm (ARM version) 28 # - Env (environment variables) 29 # Default: `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}` 30 name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" 31 32 # Replacements for GOOS and GOARCH in the package name. 33 # Keys should be valid GOOSs or GOARCHs. 34 # Values are the respective replacements. 35 # Default is empty. 36 replacements: 37 amd64: 64-bit 38 386: 32-bit 39 darwin: macOS 40 linux: Tux 41 42 # Your app's vendor. 43 # Default is empty. 44 vendor: Drum Roll Inc. 45 # Your app's homepage. 46 # Default is empty. 47 homepage: https://example.com/ 48 49 # Your app's maintainer (probably you). 50 # Default is empty. 51 maintainer: Drummer <drum-roll@example.com> 52 53 # Your app's description. 54 # Default is empty. 55 description: Software to create fast and easy drum rolls. 56 57 # Your app's license. 58 # Default is empty. 59 license: Apache 2.0 60 61 # Formats to be generated. 62 formats: 63 - deb 64 - rpm 65 66 # Packages your package depends on. 67 dependencies: 68 - git 69 - zsh 70 71 # Packages your package recommends installing. 72 # For RPM packages rpmbuild >= 4.13 is required 73 recommends: 74 - bzr 75 - gtk 76 77 # Packages your package suggests installing. 78 # For RPM packages rpmbuild >= 4.13 is required 79 suggests: 80 - cvs 81 - ksh 82 83 # Packages that conflict with your package. 84 conflicts: 85 - svn 86 - bash 87 88 # Override default /usr/local/bin destination for binaries 89 bindir: /usr/bin 90 91 # Files or directories to add to your package (beyond the binary). 92 # Keys are source paths/globs to get the files from. 93 # Values are the destination locations of the files in the package. 94 files: 95 "scripts/etc/init.d/": "/etc/init.d" 96 "path/**/glob": "/var/foo/glob" 97 98 # Config files to add to your package. They are about the same as 99 # the files keyword, except package managers treat them differently (while 100 # uninstalling, mostly). 101 # Keys are source paths/globs to get the files from. 102 # Values are the destination locations of the files in the package. 103 config_files: 104 "tmp/app_generated.conf": "/etc/app.conf" 105 "conf/*.conf": "/etc/foo/" 106 ``` 107 108 Note that GoReleaser will not install `rpmbuild` or any dependencies for you. 109 As for now, `rpmbuild` is recommended if you want to generate rpm packages. 110 You can install it with `apt-get install rpm` or `brew install rpm`. 111 112 ## Snapcraft 113 114 GoReleaser can also generate `snap` packages. 115 [Snaps](http://snapcraft.io/) are a new packaging format, that will let you 116 publish your project directly to the Ubuntu store. 117 From there it will be installable in all the 118 [supported Linux distros](https://snapcraft.io/docs/core/install), with 119 automatic and transactional updates. 120 121 You can read more about it in the [snapcraft docs](https://snapcraft.io/docs/). 122 123 Available options: 124 125 ```yml 126 # .goreleaser.yml 127 snapcraft: 128 # You can change the name of the package. 129 # This is parsed with the Go template engine and the following variables 130 # are available: 131 # - ProjectName 132 # - Tag 133 # - Version (Git tag without `v` prefix) 134 # - Os 135 # - Arch 136 # - Arm (ARM version) 137 # - Env (environment variables) 138 # Default: `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}` 139 name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" 140 141 # Replacements for GOOS and GOARCH in the package name. 142 # Keys should be valid GOOSs or GOARCHs. 143 # Values are the respective replacements. 144 # Default is empty. 145 replacements: 146 amd64: 64-bit 147 386: 32-bit 148 darwin: macOS 149 linux: Tux 150 151 # The name of the snap. This is optional. 152 # Default is project name. 153 name: drumroll 154 155 # Single-line elevator pitch for your amazing snap. 156 # 79 char long at most. 157 summary: Software to create fast and easy drum rolls. 158 159 # This the description of your snap. You have a paragraph or two to tell the 160 # most important story about your snap. Keep it under 100 words though, 161 # we live in tweetspace and your description wants to look good in the snap 162 # store. 163 description: | 164 This is the best drum roll application out there. 165 Install it and awe! 166 167 # A guardrail to prevent you from releasing a snap to all your users before 168 # it is ready. 169 # `devel` will let you release only to the `edge` and `beta` channels in the 170 # store. `stable` will let you release also to the `candidate` and `stable` 171 # channels. More info about channels here: 172 # https://snapcraft.io/docs/reference/channels 173 grade: stable 174 175 # Snaps can be setup to follow three different confinement policies: 176 # `strict`, `devmode` and `classic`. A strict confinement where the snap 177 # can only read and write in its own namespace is recommended. Extra 178 # permissions for strict snaps can be declared as `plugs` for the app, which 179 # are explained later. More info about confinement here: 180 # https://snapcraft.io/docs/reference/confinement 181 confinement: strict 182 183 # Each binary built by GoReleaser is an app inside the snap. In this section 184 # you can declare extra details for those binaries. It is optional. 185 apps: 186 187 # The name of the app must be the same name as the binary built. 188 drumroll: 189 190 # If your app requires extra permissions to work outside of its default 191 # confined space, declare them here. 192 # You can read the documentation about the available plugs and the 193 # things they allow: 194 # https://snapcraft.io/docs/reference/interfaces). 195 plugs: ["home", "network"] 196 197 # If you want your app to be autostarted and to always run in the 198 # background, you can make it a simple daemon. 199 daemon: simple 200 ``` 201 202 Note that GoReleaser will not install `snapcraft` nor any of its dependencies 203 for you.